├── .gitignore ├── qwt ├── .gitignore └── qwt.prf ├── README.md ├── model ├── latticeboltzmann │ ├── immersed │ │ ├── fileitem.h │ │ ├── lineitem.h │ │ ├── circleitem.h │ │ ├── rectangleitem.h │ │ ├── circleitem.cpp │ │ ├── lineitem.cpp │ │ ├── rectangleitem.cpp │ │ ├── immersedboundarycontainer.h │ │ ├── fileitem.cpp │ │ └── immerseditem.h │ ├── streamline │ │ ├── velocityevaluator.cpp │ │ ├── streamlinealgorithm.cpp │ │ ├── velocityevaluator.h │ │ ├── nextcellevalutor.h │ │ ├── streamlinecurve.cpp │ │ ├── streamlinecurve.h │ │ ├── velocitylinearinterpolator.h │ │ ├── nearestpointvelocityevaluator.h │ │ ├── euler.h │ │ ├── seedgenerator.h │ │ ├── velocitylinearinterpolator.cpp │ │ ├── streamlinealgorithm.h │ │ ├── streamlinegenerator.cpp │ │ ├── euler.cpp │ │ ├── streamlinegenerator.h │ │ ├── nextcellevalutor.cpp │ │ └── nearestpointvelocityevaluator.cpp │ ├── meltingsolidification │ │ ├── kornerimplementation.h │ │ └── meltingsolidificationcell.h │ ├── deposition │ │ ├── depositionwall.cpp │ │ ├── depositionwall.h │ │ └── depositioncell.h │ ├── basecell.cpp │ ├── force │ │ ├── forcelist.h │ │ ├── gravity.h │ │ ├── multicomponent.h │ │ ├── force.h │ │ ├── multiphase.h │ │ ├── passivescalarforce.h │ │ └── gravity.cpp │ ├── boundary │ │ ├── boundary.h │ │ ├── reflectwithfactorcell.h │ │ ├── dragwallcell.h │ │ ├── reflectwithfactorcell.cpp │ │ ├── extrapolationboundary.h │ │ ├── zouheboundary.h │ │ ├── pointboundary.h │ │ ├── partialslipboundary.h │ │ ├── fixedboundary.h │ │ ├── equilibriumboundary.h │ │ ├── wallcell.h │ │ └── dragwallcell.cpp │ ├── moving │ │ ├── gridchange.cpp │ │ ├── gridchange.h │ │ ├── somethingmoving.h │ │ ├── movingwall.h │ │ ├── movingcell.h │ │ └── particlemanager.h │ ├── extra │ │ ├── initialparticle.h │ │ ├── particle.h │ │ ├── particle.cpp │ │ ├── startingparticle.h │ │ └── velocityfield.h │ ├── porouscell.h │ ├── lbutil.h │ ├── interpolation │ │ └── interpolationcell.h │ ├── passivescalar │ │ ├── configuration.h │ │ └── momentpropagationcell.h │ ├── gridsimulation.h │ ├── nullcell.h │ ├── physical │ │ └── parameters.h │ ├── multi │ │ ├── fecell.h │ │ └── rkcell.h │ ├── shallow │ │ └── shallowcell.h │ ├── thermal │ │ ├── thermalwall.h │ │ └── passivescalar.h │ ├── nullcell.cpp │ └── basecell.h ├── math │ ├── mytwovector3d.cpp │ ├── mytwovector3d.h │ ├── util.h │ ├── util.cpp │ ├── myquaternion.h │ ├── vector3i.h │ └── myvector3d.h ├── inputoutput │ ├── vtkreporter.h │ ├── simulationreporter.h │ ├── matlabreporter.h │ ├── loaderfromtext.h │ ├── iterationreporter.h │ ├── loaderfromimage.h │ └── matlabreporter.cpp ├── listener │ ├── listener.h │ ├── listenerdata.h │ └── listenerdata.cpp └── util │ ├── shared.h │ └── shared.cpp ├── view ├── immersed.h ├── painter │ ├── isolineseeder.cpp │ ├── isolineseeder.h │ ├── customseeder.cpp │ ├── customseeder.h │ ├── equallyspacedseeder.h │ ├── paintercell.h │ ├── isosurfacehelper.h │ ├── equallyspacedseeder.cpp │ ├── paintercell.cpp │ └── camera.h ├── util │ ├── xypoint.cpp │ ├── xypoint.h │ ├── executor.h │ ├── executor.cpp │ ├── historylineedit.h │ ├── scrolldecorator.h │ ├── improvedlineedit.h │ ├── scrolldecorator.cpp │ ├── historylineedit.cpp │ ├── singleton.h │ └── improvedlineedit.cpp ├── moreinfo.ui ├── changes.cpp ├── changes.h ├── moreinfo.cpp ├── about.h ├── about.cpp ├── moreinfo.h ├── codeeditor.h ├── geometry.h ├── animation.h ├── interpolation.h ├── mesher.h ├── colors.h ├── immersed.ui ├── results.h ├── painterconfig.h ├── view2.h ├── codeeditor.ui ├── imageprocessing.h └── particles.h └── lbmain.cpp /.gitignore: -------------------------------------------------------------------------------- 1 | LatticeBoltzmann.pro.user 2 | -------------------------------------------------------------------------------- /qwt/.gitignore: -------------------------------------------------------------------------------- 1 | Makefile 2 | .qmake.stash 3 | obj 4 | moc 5 | rcc 6 | lib 7 | bin 8 | html 9 | plugins 10 | resources 11 | Doxygen.log 12 | *.swp 13 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | lbsim 2 | ===== 3 | 4 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 5 | 6 | For more information, see the wiki: https://github.com/fabioskomori/lbsim/wiki 7 | -------------------------------------------------------------------------------- /model/latticeboltzmann/immersed/fileitem.h: -------------------------------------------------------------------------------- 1 | #ifndef FILEITEM_H 2 | #define FILEITEM_H 3 | 4 | #include "immerseditem.h" 5 | 6 | class FileItem : public ImmersedItem { 7 | public: 8 | FileItem(); 9 | void create(); 10 | QString getType(); 11 | }; 12 | 13 | #endif // FILEITEM_H 14 | -------------------------------------------------------------------------------- /model/latticeboltzmann/immersed/lineitem.h: -------------------------------------------------------------------------------- 1 | #ifndef LINEITEM_H 2 | #define LINEITEM_H 3 | 4 | #include "immerseditem.h" 5 | 6 | class LineItem : public ImmersedItem { 7 | public: 8 | LineItem(); 9 | void create(); 10 | QString getType(); 11 | }; 12 | 13 | #endif // LINEITEM_H 14 | -------------------------------------------------------------------------------- /model/math/mytwovector3d.cpp: -------------------------------------------------------------------------------- 1 | #include "mytwovector3d.h" 2 | 3 | MyTwoVector3D::MyTwoVector3D(MyVector3D v1, MyVector3D v2) : v1(v1), v2(v2) { 4 | } 5 | 6 | MyVector3D MyTwoVector3D::getV1() { 7 | return v1; 8 | } 9 | 10 | MyVector3D MyTwoVector3D::getV2() { 11 | return v2; 12 | } 13 | -------------------------------------------------------------------------------- /model/latticeboltzmann/immersed/circleitem.h: -------------------------------------------------------------------------------- 1 | #ifndef CIRCLEITEM_H 2 | #define CIRCLEITEM_H 3 | 4 | #include "immerseditem.h" 5 | 6 | class CircleItem : public ImmersedItem { 7 | public: 8 | CircleItem(); 9 | void create(); 10 | QString getType(); 11 | }; 12 | 13 | #endif // CIRCLEITEM_H 14 | -------------------------------------------------------------------------------- /model/latticeboltzmann/immersed/rectangleitem.h: -------------------------------------------------------------------------------- 1 | #ifndef RECTANGLEITEM_H 2 | #define RECTANGLEITEM_H 3 | 4 | #include "immerseditem.h" 5 | 6 | class RectangleItem : public ImmersedItem { 7 | public: 8 | RectangleItem(); 9 | void create(); 10 | QString getType(); 11 | }; 12 | 13 | #endif // RECTANGLEITEM_H 14 | -------------------------------------------------------------------------------- /model/math/mytwovector3d.h: -------------------------------------------------------------------------------- 1 | #ifndef MYTWOVECTOR3D_H 2 | #define MYTWOVECTOR3D_H 3 | 4 | #include "myvector3d.h" 5 | 6 | class MyTwoVector3D { 7 | public: 8 | MyTwoVector3D(MyVector3D v1, MyVector3D v2); 9 | MyVector3D getV1(); 10 | MyVector3D getV2(); 11 | private: 12 | MyVector3D v1; 13 | MyVector3D v2; 14 | }; 15 | 16 | #endif // MYTWOVECTOR3D_H 17 | -------------------------------------------------------------------------------- /view/immersed.h: -------------------------------------------------------------------------------- 1 | #ifndef IMMERSED_H 2 | #define IMMERSED_H 3 | 4 | #include 5 | 6 | namespace Ui { 7 | class Immersed; 8 | } 9 | 10 | class LBWidget; 11 | class ImmersedItem; 12 | 13 | class Immersed : public QDialog { 14 | Q_OBJECT 15 | public: 16 | explicit Immersed(QWidget *parent = 0); 17 | ~Immersed(); 18 | void inject(LBWidget *widget); 19 | void sync(); 20 | private slots: 21 | void on_immersedAdd_clicked(); 22 | void on_immersedType_currentIndexChanged(const QString &arg1); 23 | void on_immersedRemove_clicked(); 24 | private: 25 | ImmersedItem* create(); 26 | Ui::Immersed *ui; 27 | LBWidget *widget; 28 | }; 29 | 30 | #endif // IMMERSED_H 31 | -------------------------------------------------------------------------------- /model/latticeboltzmann/immersed/circleitem.cpp: -------------------------------------------------------------------------------- 1 | #include "circleitem.h" 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | #define PI 3.14159265 8 | 9 | CircleItem::CircleItem() { 10 | parameters["points"] = "10"; 11 | parameters["x"] = "10"; 12 | parameters["y"] = "10"; 13 | parameters["radius"] = "10"; 14 | } 15 | 16 | void CircleItem::create() { 17 | for (int i = 0; i < getIntParameter(QString("points")); i++) { 18 | points->push_back(MyVector3D(getParameter("x") + getParameter("radius") * std::cos(2 * PI * i / getParameter("points")), getParameter("y") + getParameter("radius") * std::sin(2 * PI * i / getParameter("points")), 0)); 19 | } 20 | } 21 | 22 | QString CircleItem::getType() { 23 | return "Circle"; 24 | } 25 | -------------------------------------------------------------------------------- /model/latticeboltzmann/immersed/lineitem.cpp: -------------------------------------------------------------------------------- 1 | #include "lineitem.h" 2 | 3 | #include 4 | 5 | LineItem::LineItem() { 6 | parameters["points"] = "10"; 7 | parameters["x1"] = "10"; 8 | parameters["y1"] = "10"; 9 | parameters["x2"] = "20"; 10 | parameters["y2"] = "20"; 11 | } 12 | 13 | void LineItem::create() { 14 | for (int i = 0; i < getIntParameter("points"); i++) { 15 | points->push_back(MyVector3D(getParameter("x1") + i * (getParameter("x2") - getParameter("x1")) / getIntParameter("points"), 16 | getParameter("y1") + i * (getParameter("y2") - getParameter("y1")) / getIntParameter("points"), 0)); 17 | } 18 | closed = false; 19 | } 20 | 21 | QString LineItem::getType() { 22 | return "Line"; 23 | } 24 | -------------------------------------------------------------------------------- /model/latticeboltzmann/immersed/rectangleitem.cpp: -------------------------------------------------------------------------------- 1 | #include "rectangleitem.h" 2 | 3 | #include 4 | 5 | RectangleItem::RectangleItem() { 6 | parameters["x"] = "5"; 7 | parameters["y"] = "5"; 8 | parameters["width"] = "5"; 9 | parameters["height"] = "5"; 10 | } 11 | 12 | void RectangleItem::create() { 13 | points->push_back(MyVector3D(getParameter("x"), getParameter("y"), 0)); 14 | points->push_back(MyVector3D(getParameter("x") + getParameter("width"), getParameter("y"), 0)); 15 | points->push_back(MyVector3D(getParameter("x") + getParameter("width"), getParameter("y") + getParameter("height"), 0)); 16 | points->push_back(MyVector3D(getParameter("x"), getParameter("y") + getParameter("height"), 0)); 17 | closed = true; 18 | } 19 | 20 | QString RectangleItem::getType() { 21 | return "Rectangle"; 22 | } 23 | -------------------------------------------------------------------------------- /model/latticeboltzmann/immersed/immersedboundarycontainer.h: -------------------------------------------------------------------------------- 1 | #ifndef IMMERSEDBOUNDARYCONTAINER_H 2 | #define IMMERSEDBOUNDARYCONTAINER_H 3 | 4 | #include 5 | class ImmersedItem; 6 | class Grid; 7 | #include "../../model/math/mytwovector3d.h" 8 | #include 9 | #include 10 | 11 | class ImmersedBoundaryContainer { 12 | public: 13 | ImmersedBoundaryContainer(Grid *grid); 14 | ~ImmersedBoundaryContainer(); 15 | std::list* getItems(); 16 | void preUpdate1(); 17 | void preUpdate2(int x, int y, int z); 18 | int addItem(ImmersedItem *item); 19 | void removeItem(int id); 20 | void passivate(QXmlStreamWriter &writer); 21 | void activate(QXmlStreamReader &reader); 22 | private: 23 | Grid *grid; 24 | std::list* items; 25 | std::list forces; 26 | }; 27 | 28 | #endif // IMMERSEDBOUNDARYCONTAINER_H 29 | -------------------------------------------------------------------------------- /model/latticeboltzmann/streamline/velocityevaluator.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "velocityevaluator.h" 20 | -------------------------------------------------------------------------------- /view/painter/isolineseeder.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "isolineseeder.h" 20 | 21 | IsolineSeeder::IsolineSeeder() { 22 | } 23 | -------------------------------------------------------------------------------- /model/latticeboltzmann/meltingsolidification/kornerimplementation.h: -------------------------------------------------------------------------------- 1 | #ifndef KORNERIMPLEMENTATION_H 2 | #define KORNERIMPLEMENTATION_H 3 | 4 | class Grid; 5 | 6 | class KornerImplementation { 7 | public: 8 | KornerImplementation(Grid *grid); 9 | void configure(double power, double standardDeviation, int startX, double velocity, int timesteps, double absorptionCoefficient); 10 | void configureThermal(double solidTau, double liquidTau, double gasTau); 11 | void configureEnergy(double solidEnergy, double liquidEnergy); 12 | void preUpdate(); 13 | double getSolidTau(); 14 | double getLiquidTau(); 15 | double getGasTau(); 16 | double getSolidEnergy(); 17 | double getLiquidEnergy(); 18 | private: 19 | Grid *grid; 20 | double power, standardDeviation, velocity; 21 | int startX, timesteps; 22 | double currentX; 23 | double absorptionCoefficient; 24 | double solidTau, liquidTau, gasTau; 25 | double solidEnergy, liquidEnergy; 26 | }; 27 | 28 | #endif // KORNERIMPLEMENTATION_H 29 | -------------------------------------------------------------------------------- /model/latticeboltzmann/immersed/fileitem.cpp: -------------------------------------------------------------------------------- 1 | #include "fileitem.h" 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | FileItem::FileItem() { 8 | parameters["file"] = ""; 9 | parameters["x"] = "0"; 10 | parameters["y"] = "0"; 11 | } 12 | 13 | void FileItem::create() { 14 | QImage image; 15 | image.load(parameters["file"]); 16 | fixedPoint = MyVector3D(-1, -1, -1); 17 | for (int x = 0; x < image.width(); x++) { 18 | for (int y = 0; y < image.height(); y++) { 19 | if (QColor(image.pixel(x, image.height() - 1 - y)) == QColor(0, 0, 255)) { 20 | points->push_back(MyVector3D(getParameter("x") + x, getParameter("y") + y, 0)); 21 | } else if (QColor(image.pixel(x, image.height() - 1 - y)) == QColor(255, 0, 0)) { 22 | fixedPoint = MyVector3D(getParameter("x") + x, getParameter("y") + y, 0); 23 | } 24 | } 25 | } 26 | cellular = true; 27 | } 28 | 29 | QString FileItem::getType() { 30 | return "File"; 31 | } 32 | -------------------------------------------------------------------------------- /view/util/xypoint.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "xypoint.h" 20 | 21 | XYPoint::XYPoint(double x, double y) : x(x), y(y) { 22 | } 23 | 24 | double XYPoint::getX() { 25 | return x; 26 | } 27 | 28 | double XYPoint::getY() { 29 | return y; 30 | } 31 | -------------------------------------------------------------------------------- /view/moreinfo.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | MoreInfo 4 | 5 | 6 | 7 | 0 8 | 0 9 | 400 10 | 300 11 | 12 | 13 | 14 | More Info 15 | 16 | 17 | 18 | 19 | 10 20 | 10 21 | 381 22 | 251 23 | 24 | 25 | 26 | 27 | 28 | 29 | 10 30 | 270 31 | 381 32 | 23 33 | 34 | 35 | 36 | Don't click here... Authorized Personnel Only! 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /view/painter/isolineseeder.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef ISOLINESEEDER_H 20 | #define ISOLINESEEDER_H 21 | 22 | class IsolineSeeder { 23 | public: 24 | IsolineSeeder(); 25 | virtual double* seed(int *count) = 0; 26 | }; 27 | 28 | #endif // ISOLINESEEDER_H 29 | -------------------------------------------------------------------------------- /model/math/util.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef UTIL_H 20 | #define UTIL_H 21 | 22 | class Util { 23 | public: 24 | Util(); 25 | static double interpolate(double x1, double x2, double value); 26 | static double dirac(double x); 27 | }; 28 | 29 | #endif // UTIL_H 30 | -------------------------------------------------------------------------------- /qwt/qwt.prf: -------------------------------------------------------------------------------- 1 | ################################################################ 2 | # Qwt Widget Library 3 | # Copyright (C) 1997 Josef Wilgen 4 | # Copyright (C) 2002 Uwe Rathmann 5 | # 6 | # This library is free software; you can redistribute it and/or 7 | # modify it under the terms of the Qwt License, Version 1.0 8 | ################################################################ 9 | 10 | include ( ./qwtconfig.pri ) 11 | include ( ./qwtfunctions.pri ) 12 | 13 | contains(QWT_CONFIG, QwtDll) { 14 | 15 | DEFINES *= QWT_DLL 16 | } 17 | 18 | contains(QWT_CONFIG, QwtSvg) { 19 | 20 | QT *= svg 21 | } 22 | else { 23 | 24 | DEFINES *= QWT_NO_SVG 25 | } 26 | 27 | contains(QWT_CONFIG, QwtOpenGL) { 28 | 29 | QT *= opengl 30 | } 31 | else { 32 | 33 | DEFINES *= QWT_NO_OPENGL 34 | } 35 | 36 | 37 | contains(QWT_CONFIG, QwtFramework) { 38 | 39 | INCLUDEPATH *= $${QWT_INSTALL_LIBS}/qwt.framework/Headers 40 | } 41 | else { 42 | 43 | INCLUDEPATH *= $${QWT_INSTALL_HEADERS} 44 | } 45 | 46 | # QMAKE_RPATHDIR *= $${QWT_INSTALL_LIBS} 47 | qwtAddLibrary($${QWT_INSTALL_LIBS}, qwt) 48 | -------------------------------------------------------------------------------- /view/util/xypoint.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef XYPOINT_H 20 | #define XYPOINT_H 21 | 22 | class XYPoint { 23 | public: 24 | XYPoint(double x, double y); 25 | double getX(); 26 | double getY(); 27 | private: 28 | double x, y; 29 | }; 30 | 31 | #endif // XYPOINT_H 32 | -------------------------------------------------------------------------------- /model/latticeboltzmann/streamline/streamlinealgorithm.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "streamlinealgorithm.h" 20 | 21 | StreamLineAlgorithm::StreamLineAlgorithm() { 22 | } 23 | 24 | void StreamLineAlgorithm::injectVelocityEvaluator(VelocityEvaluator *ve) { 25 | this->ve = ve; 26 | } 27 | -------------------------------------------------------------------------------- /model/inputoutput/vtkreporter.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef VTKREPORTER_H 20 | #define VTKREPORTER_H 21 | 22 | class Grid; 23 | #include 24 | 25 | class VTKReporter { 26 | public: 27 | VTKReporter(); 28 | static void exportVTK(Grid *grid, QString fileName); 29 | }; 30 | 31 | #endif // VTKREPORTER_H 32 | -------------------------------------------------------------------------------- /model/latticeboltzmann/deposition/depositionwall.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "depositionwall.h" 20 | #include 21 | 22 | DepositionWall::DepositionWall() { 23 | } 24 | 25 | void DepositionWall::passivate(QXmlStreamWriter &writer) { 26 | writer.writeAttribute("type", "depositionWall"); 27 | } 28 | -------------------------------------------------------------------------------- /model/inputoutput/simulationreporter.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef SIMULATIONREPORTER_H 20 | #define SIMULATIONREPORTER_H 21 | 22 | class QString; 23 | class Grid; 24 | 25 | class SimulationReporter { 26 | public: 27 | static void reportSimulation(Grid *grid, QString &fileName); 28 | }; 29 | 30 | #endif // SIMULATIONREPORTER_H 31 | -------------------------------------------------------------------------------- /view/changes.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "changes.h" 20 | #include "ui_changes.h" 21 | 22 | Changes::Changes(QWidget *parent) : QDialog(parent), ui(new Ui::Changes) { 23 | ui->setupUi(this); 24 | //setWindowFlags(Qt::Dialog | Qt::WindowStaysOnTopHint); 25 | } 26 | 27 | Changes::~Changes() { 28 | delete ui; 29 | } 30 | -------------------------------------------------------------------------------- /model/inputoutput/matlabreporter.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef MATLABREPORTER_H 20 | #define MATLABREPORTER_H 21 | 22 | class Grid; 23 | class QString; 24 | 25 | class MATLABReporter { 26 | public: 27 | MATLABReporter(); 28 | void streamlines(Grid *grid, QString &fileName, QString start); 29 | }; 30 | 31 | #endif // MATLABREPORTER_H 32 | -------------------------------------------------------------------------------- /model/latticeboltzmann/streamline/velocityevaluator.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef VELOCITYEVALUATOR_H 20 | #define VELOCITYEVALUATOR_H 21 | 22 | class MyVector3D; 23 | class Grid; 24 | 25 | class VelocityEvaluator { 26 | public: 27 | virtual MyVector3D evaluate(MyVector3D point, Grid *grid) = 0; 28 | }; 29 | 30 | #endif // VELOCITYEVALUATOR_H 31 | -------------------------------------------------------------------------------- /view/painter/customseeder.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "customseeder.h" 20 | 21 | CustomSeeder::CustomSeeder(double *seeds, int count) : seeds(seeds), count(count) { 22 | } 23 | 24 | CustomSeeder::~CustomSeeder() { 25 | delete[] seeds; 26 | } 27 | 28 | double* CustomSeeder::seed(int *c) { 29 | *c = count; 30 | return seeds; 31 | } 32 | -------------------------------------------------------------------------------- /model/inputoutput/loaderfromtext.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef LOADERFROMTEXT_H 20 | #define LOADERFROMTEXT_H 21 | 22 | class QString; 23 | class Grid; 24 | 25 | class LoaderFromText { 26 | public: 27 | static void load(Grid *grid, QString &fileName); 28 | static void save(Grid *grid, QString &fileName); 29 | }; 30 | 31 | #endif // LOADERFROMTEXT_H 32 | -------------------------------------------------------------------------------- /model/listener/listener.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef LISTENER_H 20 | #define LISTENER_H 21 | 22 | #define LISTENER_EVENT_GRIDUPDATE 1 23 | #define LISTENER_EVENT_RESET 2 24 | #define LISTENER_EVENT_INIT 3 25 | #define LISTENER_EVENT_ACTIVATE 4 26 | 27 | class Listener { 28 | public: 29 | virtual void callback(int event) = 0; 30 | }; 31 | 32 | #endif // LISTENER_H 33 | -------------------------------------------------------------------------------- /view/util/executor.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef EXECUTOR_H 20 | #define EXECUTOR_H 21 | 22 | #include 23 | class LBWidget; 24 | 25 | class Executor : public QThread { 26 | public: 27 | Executor(LBWidget *widget); 28 | virtual void run(); 29 | void stop(); 30 | private: 31 | bool active; 32 | LBWidget *widget; 33 | }; 34 | 35 | #endif // EXECUTOR_H 36 | -------------------------------------------------------------------------------- /model/latticeboltzmann/deposition/depositionwall.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef DEPOSITIONWALL_H 20 | #define DEPOSITIONWALL_H 21 | 22 | #include "../../../model/latticeboltzmann/boundary/wallcell.h" 23 | 24 | class DepositionWall : public WallCell { 25 | public: 26 | DepositionWall(); 27 | void passivate(QXmlStreamWriter &writer); 28 | }; 29 | 30 | #endif // DEPOSITIONWALL_H 31 | -------------------------------------------------------------------------------- /view/util/executor.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "executor.h" 20 | #include "../../view/lbwidget.h" 21 | 22 | Executor::Executor(LBWidget *widget) { 23 | this->widget = widget; 24 | active = true; 25 | } 26 | 27 | void Executor::run() { 28 | while (active) { 29 | widget->run(); 30 | } 31 | } 32 | 33 | void Executor::stop() { 34 | active = false; 35 | } 36 | -------------------------------------------------------------------------------- /model/inputoutput/iterationreporter.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef VELOCITYREPORTER_H 20 | #define VELOCITYREPORTER_H 21 | 22 | class QString; 23 | class Grid; 24 | 25 | class IterationReporter { 26 | public: 27 | IterationReporter(int x, int y, int z); 28 | void reportCsv(Grid *grid, QString &fileName); 29 | private: 30 | int x, y, z; 31 | }; 32 | 33 | #endif // VELOCITYREPORTER_H 34 | -------------------------------------------------------------------------------- /model/latticeboltzmann/basecell.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "basecell.h" 20 | #include 21 | 22 | void BaseCell::updateFromOpenCL(double*) { 23 | } 24 | 25 | void BaseCell::passivate(QXmlStreamWriter& ) { 26 | } 27 | 28 | void BaseCell::activate(QXmlStreamReader& , Grid*) { 29 | } 30 | 31 | BaseCell::~BaseCell() { 32 | } 33 | 34 | BaseCell* BaseCell::clone() { 35 | return 0; 36 | } 37 | -------------------------------------------------------------------------------- /view/changes.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef CHANGES_H 20 | #define CHANGES_H 21 | 22 | #include 23 | 24 | namespace Ui { 25 | class Changes; 26 | } 27 | 28 | class Changes : public QDialog 29 | { 30 | Q_OBJECT 31 | 32 | public: 33 | explicit Changes(QWidget *parent = 0); 34 | ~Changes(); 35 | 36 | private: 37 | Ui::Changes *ui; 38 | }; 39 | 40 | #endif // CHANGES_H 41 | -------------------------------------------------------------------------------- /view/moreinfo.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "moreinfo.h" 20 | #include "ui_moreinfo.h" 21 | 22 | MoreInfo::MoreInfo(QWidget *parent) : QDialog(parent), ui(new Ui::MoreInfo) { 23 | ui->setupUi(this); 24 | } 25 | 26 | MoreInfo::~MoreInfo() { 27 | delete ui; 28 | } 29 | 30 | void MoreInfo::inject(Grid *grid) { 31 | this->grid = grid; 32 | } 33 | 34 | void MoreInfo::on_test_clicked() { 35 | } 36 | -------------------------------------------------------------------------------- /model/util/shared.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef SHARED_H 20 | #define SHARED_H 21 | 22 | class GridConfig; 23 | 24 | class Shared { 25 | public: 26 | static Shared* instance(); 27 | GridConfig* getGridConfig(); 28 | void setGridConfig(GridConfig *gridConfig); 29 | private: 30 | static Shared *newShared; 31 | Shared(); 32 | GridConfig *gridConfig; 33 | }; 34 | 35 | #endif // SHARED_H 36 | -------------------------------------------------------------------------------- /view/painter/customseeder.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef CUSTOMSEEDER_H 20 | #define CUSTOMSEEDER_H 21 | 22 | #include "isolineseeder.h" 23 | 24 | class CustomSeeder : public IsolineSeeder { 25 | public: 26 | CustomSeeder(double *seeds, int count); 27 | ~CustomSeeder(); 28 | double* seed(int *count); 29 | private: 30 | double *seeds; 31 | int count; 32 | }; 33 | 34 | #endif // CUSTOMSEEDER_H 35 | -------------------------------------------------------------------------------- /model/latticeboltzmann/streamline/nextcellevalutor.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef NEXTCELLEVALUTOR_H 20 | #define NEXTCELLEVALUTOR_H 21 | 22 | #include "streamlinealgorithm.h" 23 | 24 | class NextCellEvalutor : public StreamLineAlgorithm { 25 | public: 26 | NextCellEvalutor(); 27 | ~NextCellEvalutor(); 28 | MyVector3D nextPoint(MyVector3D point, Grid *grid); 29 | }; 30 | 31 | #endif // NEXTCELLEVALUTOR_H 32 | -------------------------------------------------------------------------------- /model/latticeboltzmann/streamline/streamlinecurve.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "streamlinecurve.h" 20 | #include "../../../model/math/myvector3d.h" 21 | 22 | StreamLineCurve::StreamLineCurve() { 23 | points = new std::list(); 24 | } 25 | 26 | StreamLineCurve::~StreamLineCurve() { 27 | delete points; 28 | } 29 | 30 | std::list* StreamLineCurve::getPoints() { 31 | return points; 32 | } 33 | -------------------------------------------------------------------------------- /model/latticeboltzmann/streamline/streamlinecurve.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef STREAMLINECURVE_H 20 | #define STREAMLINECURVE_H 21 | 22 | #include 23 | class MyVector3D; 24 | 25 | class StreamLineCurve { 26 | public: 27 | StreamLineCurve(); 28 | ~StreamLineCurve(); 29 | std::list* getPoints(); 30 | private: 31 | std::list *points; 32 | }; 33 | 34 | #endif // STREAMLINECURVE_H 35 | -------------------------------------------------------------------------------- /model/latticeboltzmann/streamline/velocitylinearinterpolator.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef VELOCITYLINEARINTERPOLATOR_H 20 | #define VELOCITYLINEARINTERPOLATOR_H 21 | 22 | #include "velocityevaluator.h" 23 | 24 | class VelocityLinearInterpolator : public VelocityEvaluator { 25 | public: 26 | VelocityLinearInterpolator(); 27 | MyVector3D evaluate(MyVector3D point, Grid *grid); 28 | }; 29 | 30 | #endif // VELOCITYLINEARINTERPOLATOR_H 31 | -------------------------------------------------------------------------------- /view/about.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef ABOUT_H 20 | #define ABOUT_H 21 | 22 | #include 23 | 24 | namespace Ui { 25 | class About; 26 | } 27 | 28 | class LBMainWindow; 29 | 30 | class About : public QDialog { 31 | Q_OBJECT 32 | public: 33 | explicit About(LBMainWindow *main, QWidget *parent = 0); 34 | ~About(); 35 | private: 36 | Ui::About *ui; 37 | LBMainWindow *main; 38 | }; 39 | 40 | #endif // ABOUT_H 41 | -------------------------------------------------------------------------------- /model/latticeboltzmann/streamline/nearestpointvelocityevaluator.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef NEARESTPOINTVELOCITYEVALUATOR_H 20 | #define NEARESTPOINTVELOCITYEVALUATOR_H 21 | 22 | #include "velocityevaluator.h" 23 | 24 | class NearestPointVelocityEvaluator : public VelocityEvaluator { 25 | public: 26 | NearestPointVelocityEvaluator(); 27 | MyVector3D evaluate(MyVector3D point, Grid *grid); 28 | }; 29 | 30 | #endif // NEARESTPOINTVELOCITYEVALUATOR_H 31 | -------------------------------------------------------------------------------- /model/latticeboltzmann/streamline/euler.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef EULER_H 20 | #define EULER_H 21 | 22 | #include "streamlinealgorithm.h" 23 | 24 | class Euler : public StreamLineAlgorithm { 25 | public: 26 | Euler(double integrationStep); 27 | ~Euler(); 28 | MyVector3D nextPoint(MyVector3D point, Grid *grid); 29 | void setIntegrationStep(double integrationStep); 30 | private: 31 | double integrationStep; 32 | }; 33 | 34 | #endif // EULER_H 35 | -------------------------------------------------------------------------------- /model/latticeboltzmann/streamline/seedgenerator.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef SEEDGENERATOR_H 20 | #define SEEDGENERATOR_H 21 | 22 | #include "streamlinegenerator.h" 23 | class Grid; 24 | 25 | class SeedGenerator : public StreamLineGenerator { 26 | public: 27 | SeedGenerator(Grid *grid); 28 | ~SeedGenerator(); 29 | std::list* generate(); 30 | void propertySetted(QString name, QString value); 31 | }; 32 | 33 | #endif // SEEDGENERATOR_H 34 | -------------------------------------------------------------------------------- /view/about.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "about.h" 20 | #include "ui_about.h" 21 | #include "lbmainwindow.h" 22 | 23 | About::About(LBMainWindow *main, QWidget *parent) : QDialog(parent), ui(new Ui::About) { 24 | this->main = main; 25 | ui->setupUi(this); 26 | //setWindowFlags(Qt::Dialog | Qt::WindowStaysOnTopHint); 27 | ui->nameVersion->setText(QString("LBSim ").append(main->getVersion())); 28 | } 29 | 30 | About::~About() { 31 | delete ui; 32 | } 33 | -------------------------------------------------------------------------------- /model/latticeboltzmann/streamline/velocitylinearinterpolator.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "velocitylinearinterpolator.h" 20 | #include "../../../model/math/myvector3d.h" 21 | #include "../../../model/latticeboltzmann/lbgrid.h" 22 | #include "../../../model/latticeboltzmann/gridconfig.h" 23 | 24 | VelocityLinearInterpolator::VelocityLinearInterpolator() { 25 | } 26 | 27 | MyVector3D VelocityLinearInterpolator::evaluate(MyVector3D, Grid*) { 28 | return MyVector3D(); 29 | } 30 | -------------------------------------------------------------------------------- /model/latticeboltzmann/force/forcelist.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef FORCELIST_H 20 | #define FORCELIST_H 21 | 22 | #include 23 | class Force; 24 | class QXmlStreamWriter; 25 | class QXmlStreamReader; 26 | class Grid; 27 | 28 | class ForceList { 29 | public: 30 | ForceList(); 31 | static void passivate(std::list *forces, QXmlStreamWriter &writer); 32 | static void activate(std::list *forces, QXmlStreamReader &reader, Grid *grid); 33 | }; 34 | 35 | #endif // FORCELIST_H 36 | -------------------------------------------------------------------------------- /view/painter/equallyspacedseeder.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef EQUALLYSPACEDSEEDER_H 20 | #define EQUALLYSPACEDSEEDER_H 21 | 22 | #include "isolineseeder.h" 23 | class Painter; 24 | 25 | class EquallySpacedSeeder : public IsolineSeeder { 26 | public: 27 | EquallySpacedSeeder(int count, Painter *painter); 28 | ~EquallySpacedSeeder(); 29 | double* seed(int *count); 30 | private: 31 | int count; 32 | Painter *painter; 33 | double *seeds; 34 | }; 35 | 36 | #endif // EQUALLYSPACEDSEEDER_H 37 | -------------------------------------------------------------------------------- /view/painter/paintercell.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef PAINTERCELL_H 20 | #define PAINTERCELL_H 21 | 22 | class BaseCell; 23 | 24 | class PainterCell { 25 | public: 26 | PainterCell(BaseCell *cell, int i, int j, int k, int c, int orientation); 27 | BaseCell* getCell(); 28 | int getI(); 29 | int getJ(); 30 | int getK(); 31 | int getC(); 32 | int getOrientation(); 33 | private: 34 | BaseCell *cell; 35 | int i, j, k, c, orientation; 36 | }; 37 | 38 | #endif // PAINTERCELL_H 39 | -------------------------------------------------------------------------------- /view/moreinfo.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef MOREINFO_H 20 | #define MOREINFO_H 21 | 22 | #include 23 | class Grid; 24 | 25 | namespace Ui { 26 | class MoreInfo; 27 | } 28 | 29 | class MoreInfo : public QDialog { 30 | Q_OBJECT 31 | public: 32 | explicit MoreInfo(QWidget *parent = 0); 33 | ~MoreInfo(); 34 | void inject(Grid *grid); 35 | private slots: 36 | void on_test_clicked(); 37 | private: 38 | Ui::MoreInfo *ui; 39 | Grid *grid; 40 | }; 41 | 42 | #endif // MOREINFO_H 43 | -------------------------------------------------------------------------------- /view/util/historylineedit.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef HISTORYLINEEDIT_H 20 | #define HISTORYLINEEDIT_H 21 | 22 | #include 23 | class QKeyEvent; 24 | 25 | class HistoryLineEdit : public QLineEdit { 26 | Q_OBJECT 27 | public: 28 | explicit HistoryLineEdit(QWidget *parent = 0); 29 | public slots: 30 | void returnPressed(); 31 | protected: 32 | void keyPressEvent(QKeyEvent *); 33 | private: 34 | QStringList history; 35 | int pointer; 36 | }; 37 | 38 | #endif // HISTORYLINEEDIT_H 39 | -------------------------------------------------------------------------------- /model/latticeboltzmann/force/gravity.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef GRAVITY_H 20 | #define GRAVITY_H 21 | 22 | #include "force.h" 23 | class GridConfig; 24 | 25 | class Gravity : public Force { 26 | public: 27 | Gravity(); 28 | MyVector3D computeForce(BaseCell *lattice, BaseCell* neighbors[], int index, int x, int y, int z, Grid *grid); 29 | bool hasEffect(); 30 | void passivate(QXmlStreamWriter &writer); 31 | void activate(QXmlStreamReader &reader, Grid *grid); 32 | }; 33 | 34 | #endif // GRAVITY_H 35 | -------------------------------------------------------------------------------- /model/latticeboltzmann/streamline/streamlinealgorithm.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef STREAMLINEALGORITHM_H 20 | #define STREAMLINEALGORITHM_H 21 | 22 | class MyVector3D; 23 | class Grid; 24 | class VelocityEvaluator; 25 | 26 | class StreamLineAlgorithm { 27 | public: 28 | StreamLineAlgorithm(); 29 | void injectVelocityEvaluator(VelocityEvaluator *ve); 30 | virtual MyVector3D nextPoint(MyVector3D point, Grid *grid) = 0; 31 | protected: 32 | VelocityEvaluator *ve; 33 | }; 34 | 35 | #endif // STREAMLINEALGORITHM_H 36 | -------------------------------------------------------------------------------- /model/latticeboltzmann/boundary/boundary.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef BOUNDARY_H 20 | #define BOUNDARY_H 21 | 22 | #include "../../../model/latticeboltzmann/basecell.h" 23 | 24 | class Boundary : public BaseCell { 25 | public: 26 | virtual void configPressure(double pressure) = 0; 27 | virtual void configVelocity(double velocity) = 0; 28 | virtual double getVelocity() = 0; 29 | virtual double getPressure() = 0; 30 | virtual void setNextF(int index, double value, int component) = 0; 31 | }; 32 | 33 | #endif // BOUNDARY_H 34 | -------------------------------------------------------------------------------- /model/latticeboltzmann/boundary/reflectwithfactorcell.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef REFLECTWITHFACTORCELL_H 20 | #define REFLECTWITHFACTORCELL_H 21 | 22 | #include "wallcell.h" 23 | class QXmlStreamWriter; 24 | 25 | class ReflectWithFactorCell : public WallCell { 26 | public: 27 | ReflectWithFactorCell(); 28 | void setNextF(int index, double value, int component); 29 | void passivate(QXmlStreamWriter &writer); 30 | int getOpenCLType(); 31 | private: 32 | double factor; 33 | }; 34 | 35 | #endif // REFLECTWITHFACTORCELL_H 36 | -------------------------------------------------------------------------------- /model/latticeboltzmann/force/multicomponent.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef MULTICOMPONENT_H 20 | #define MULTICOMPONENT_H 21 | 22 | #include "force.h" 23 | class GridConfig; 24 | 25 | class MultiComponent : public Force { 26 | public: 27 | MultiComponent(); 28 | MyVector3D computeForce(BaseCell *lattice, BaseCell *neighbors[], int index, int x, int y, int z, Grid *grid); 29 | bool hasEffect(); 30 | void passivate(QXmlStreamWriter &writer); 31 | void activate(QXmlStreamReader &reader, Grid *grid); 32 | }; 33 | 34 | #endif // MULTICOMPONENT_H 35 | -------------------------------------------------------------------------------- /model/latticeboltzmann/moving/gridchange.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "gridchange.h" 20 | 21 | GridChange::GridChange(Vector3i position, BaseCell *lattice, BaseCell *fillingLattice) { 22 | this->position = position; 23 | this->lattice = lattice; 24 | this->fillingLattice = fillingLattice; 25 | } 26 | 27 | Vector3i GridChange::getPosition() { 28 | return position; 29 | } 30 | 31 | BaseCell* GridChange::getLattice() { 32 | return lattice; 33 | } 34 | 35 | BaseCell* GridChange::getFillingLattice() { 36 | return fillingLattice; 37 | } 38 | -------------------------------------------------------------------------------- /model/latticeboltzmann/moving/gridchange.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef GRIDCHANGE_H 20 | #define GRIDCHANGE_H 21 | 22 | #include "../../../model/math/vector3i.h" 23 | class BaseCell; 24 | 25 | class GridChange { 26 | public: 27 | GridChange(Vector3i position, BaseCell *lattice, BaseCell *fillingLattice = 0); 28 | BaseCell* getLattice(); 29 | Vector3i getPosition(); 30 | BaseCell* getFillingLattice(); 31 | private: 32 | Vector3i position; 33 | BaseCell *lattice; 34 | BaseCell *fillingLattice; 35 | }; 36 | 37 | #endif // GRIDCHANGE_H 38 | -------------------------------------------------------------------------------- /model/util/shared.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "shared.h" 20 | #include "../../model/latticeboltzmann/gridconfig.h" 21 | #include 22 | 23 | Shared* Shared::newShared = 0; 24 | 25 | Shared::Shared() { 26 | } 27 | 28 | Shared* Shared::instance() { 29 | if (!newShared) { 30 | newShared = new Shared(); 31 | } 32 | return newShared; 33 | } 34 | 35 | GridConfig* Shared::getGridConfig() { 36 | return gridConfig; 37 | } 38 | 39 | void Shared::setGridConfig(GridConfig *gridConfig) { 40 | this->gridConfig = gridConfig; 41 | } 42 | -------------------------------------------------------------------------------- /view/util/scrolldecorator.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef SCROLLDECORATOR_H 20 | #define SCROLLDECORATOR_H 21 | 22 | #include 23 | class QScrollArea; 24 | 25 | class ScrollDecorator : public QDockWidget { 26 | public: 27 | ScrollDecorator(QDockWidget* dockWidget, int minWidth, int minHeight, QWidget *parent, QString title); 28 | QSize minimumSizeHint() const; 29 | ~ScrollDecorator(); 30 | private: 31 | QDockWidget *dockWidget; 32 | QScrollArea *scrollArea; 33 | int minWidth, minHeight; 34 | }; 35 | 36 | #endif // SCROLLDECORATOR_H 37 | -------------------------------------------------------------------------------- /model/math/util.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "util.h" 20 | #include 21 | #include 22 | 23 | #define PI 3.14159265 24 | 25 | Util::Util() { 26 | } 27 | 28 | double Util::interpolate(double x1, double x2, double value) { 29 | if (x1 == 0 || x2 == 0 || x1 == x2) { 30 | return -1; 31 | } 32 | return (value - x1) / (x2 - x1); 33 | } 34 | 35 | double Util::dirac(double x) { 36 | if (x < 0) { 37 | x = -x; 38 | } 39 | if (x > 2) { 40 | return 0; 41 | } 42 | return 0.25 * (1 + std::cos(PI * x / 2)); 43 | } 44 | -------------------------------------------------------------------------------- /model/latticeboltzmann/force/force.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef FORCE_H 20 | #define FORCE_H 21 | 22 | class MyVector3D; 23 | class BaseCell; 24 | class Grid; 25 | class QXmlStreamWriter; 26 | class QXmlStreamReader; 27 | 28 | class Force { 29 | public: 30 | virtual MyVector3D computeForce(BaseCell *lattice, BaseCell* neighbors[], int index, int x, int y, int z, Grid *grid) = 0; 31 | virtual bool hasEffect() = 0; 32 | virtual void passivate(QXmlStreamWriter &writer) = 0; 33 | virtual void activate(QXmlStreamReader &reader, Grid *grid) = 0; 34 | }; 35 | 36 | #endif // FORCE_H 37 | -------------------------------------------------------------------------------- /view/codeeditor.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef CODEEDITOR_H 20 | #define CODEEDITOR_H 21 | 22 | #include 23 | 24 | namespace Ui { 25 | class CodeEditor; 26 | } 27 | 28 | class CodeEditor : public QMainWindow { 29 | Q_OBJECT 30 | public: 31 | explicit CodeEditor(QWidget *parent = 0); 32 | ~CodeEditor(); 33 | private slots: 34 | void on_actionLoad_lb2_triggered(); 35 | void on_actionLoad_lb_triggered(); 36 | void on_actionSave_lb_triggered(); 37 | void on_actionSave_lb2_triggered(); 38 | private: 39 | Ui::CodeEditor *ui; 40 | }; 41 | 42 | #endif // CODEEDITOR_H 43 | -------------------------------------------------------------------------------- /view/geometry.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef GEOMETRY_H 20 | #define GEOMETRY_H 21 | 22 | #include 23 | 24 | namespace Ui { 25 | class Geometry; 26 | } 27 | 28 | class Geometry : public QMainWindow { 29 | Q_OBJECT 30 | public: 31 | explicit Geometry(QWidget *parent = 0); 32 | ~Geometry(); 33 | public slots: 34 | void run(); 35 | private slots: 36 | void on_actionNew_triggered(); 37 | void on_actionGenerate_triggered(); 38 | void on_actionSave_triggered(); 39 | void on_actionOpen_triggered(); 40 | private: 41 | Ui::Geometry *ui; 42 | }; 43 | 44 | #endif // GEOMETRY_H 45 | -------------------------------------------------------------------------------- /view/painter/isosurfacehelper.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef ISOSURFACEHELPER_H 20 | #define ISOSURFACEHELPER_H 21 | 22 | #include 23 | 24 | class IsosurfaceHelper { 25 | public: 26 | IsosurfaceHelper(int point1, int point2, double value); 27 | bool isNeighbor(IsosurfaceHelper ih); 28 | void merge(IsosurfaceHelper other); 29 | bool equals(IsosurfaceHelper other); 30 | void order(); 31 | int count(); 32 | std::list getPoints(); 33 | std::list getValues(); 34 | private: 35 | std::list points; 36 | std::list values; 37 | }; 38 | 39 | #endif // ISOSURFACEHELPER_H 40 | -------------------------------------------------------------------------------- /view/painter/equallyspacedseeder.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "equallyspacedseeder.h" 20 | #include "painter.h" 21 | 22 | EquallySpacedSeeder::EquallySpacedSeeder(int count, Painter *painter) : count(count), painter(painter) { 23 | seeds = new double[count]; 24 | } 25 | 26 | EquallySpacedSeeder::~EquallySpacedSeeder() { 27 | delete[] seeds; 28 | } 29 | 30 | double* EquallySpacedSeeder::seed(int *c) { 31 | *c = count; 32 | for (int i = 0; i < count; i++) { 33 | seeds[i] = painter->getColorAverage() - painter->getColorDelta() + (2 * painter->getColorDelta()) / count * (i + 0.5); 34 | } 35 | return seeds; 36 | } 37 | -------------------------------------------------------------------------------- /view/painter/paintercell.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "paintercell.h" 20 | 21 | PainterCell::PainterCell(BaseCell *cell, int i, int j, int k, int c, int orientation) : cell(cell), i(i), j(j), k(k), c(c), orientation(orientation) { 22 | } 23 | 24 | BaseCell* PainterCell::getCell() { 25 | return cell; 26 | } 27 | 28 | int PainterCell::getI() { 29 | return i; 30 | } 31 | 32 | int PainterCell::getJ() { 33 | return j; 34 | } 35 | 36 | int PainterCell::getK() { 37 | return k; 38 | } 39 | 40 | int PainterCell::getC() { 41 | return c; 42 | } 43 | 44 | int PainterCell::getOrientation() { 45 | return orientation; 46 | } 47 | -------------------------------------------------------------------------------- /model/latticeboltzmann/immersed/immerseditem.h: -------------------------------------------------------------------------------- 1 | #ifndef IMMERSEDITEM_H 2 | #define IMMERSEDITEM_H 3 | 4 | #include "../../model/math/myvector3d.h" 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | class ImmersedItem { 12 | public: 13 | ImmersedItem(); 14 | ~ImmersedItem(); 15 | void calculateCenterOfMass(); 16 | MyVector3D getCenterOfMass(); 17 | std::list* getPoints(); 18 | void setPoints(std::list *points); 19 | double getParameter(QString name); 20 | int getIntParameter(QString name); 21 | QString getStringParameter(QString name); 22 | void setParameter(QString name, double value); 23 | QString parametersToString(); 24 | void parametersFromString(QString string); 25 | virtual void create() = 0; 26 | void setId(int id); 27 | int getId(); 28 | void setClosed(bool closed); 29 | bool isClosed(); 30 | void setCellular(bool cellular); 31 | bool isCellular(); 32 | MyVector3D getFixedPoint(); 33 | void passivate(QXmlStreamWriter &writer); 34 | void activate(QXmlStreamReader &reader); 35 | virtual QString getType() = 0; 36 | protected: 37 | std::list *points; 38 | std::map parameters; 39 | MyVector3D centerOfMass; 40 | MyVector3D fixedPoint; 41 | int id; 42 | bool closed; 43 | bool cellular; 44 | }; 45 | 46 | #endif // IMMERSEDITEM_H 47 | -------------------------------------------------------------------------------- /model/latticeboltzmann/force/multiphase.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef MULTIPHASE_H 20 | #define MULTIPHASE_H 21 | 22 | #include "force.h" 23 | class GridConfig; 24 | class BaseCell; 25 | class MyVector3D; 26 | 27 | class MultiPhase : public Force { 28 | public: 29 | MultiPhase(); 30 | MyVector3D computeForce(BaseCell *lattice, BaseCell* neighbors[], int index, int x, int y, int z, Grid *grid); 31 | bool hasEffect(); 32 | void passivate(QXmlStreamWriter &writer); 33 | void activate(QXmlStreamReader &reader, Grid *grid); 34 | private: 35 | double computePsi0(BaseCell *lattice, Grid *grid); 36 | }; 37 | 38 | #endif // MULTIPHASE_H 39 | -------------------------------------------------------------------------------- /view/util/improvedlineedit.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef IMPROVEDLINEEDIT_H 20 | #define IMPROVEDLINEEDIT_H 21 | 22 | #include 23 | class QKeyEvent; 24 | 25 | class ImprovedLineEdit : public QLineEdit { 26 | Q_OBJECT 27 | public: 28 | explicit ImprovedLineEdit(QWidget *parent = 0); 29 | void setAllowDecimal(bool allowDecimal); 30 | void setAllowNegative(bool allowNegative); 31 | protected: 32 | void keyPressEvent(QKeyEvent *); 33 | signals: 34 | public slots: 35 | void textEdited(); 36 | void returnPressed(); 37 | private: 38 | bool allowDecimal; 39 | bool allowNegative; 40 | }; 41 | 42 | #endif // IMPROVEDLINEEDIT_H 43 | -------------------------------------------------------------------------------- /model/latticeboltzmann/extra/initialparticle.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef INITIALPARTICLE_H 20 | #define INITIALPARTICLE_H 21 | 22 | #include "../../../model/math/vector3i.h" 23 | #include 24 | class Particle; 25 | class Grid; 26 | 27 | class InitialParticle { 28 | public: 29 | InitialParticle(Vector3i position, Vector3i color, int id); 30 | ~InitialParticle(); 31 | int getId(); 32 | void process(Grid *grid); 33 | void reset(); 34 | std::list* getStreakLines(); 35 | private: 36 | Vector3i position; 37 | Vector3i color; 38 | int id; 39 | std::list *streakLines; 40 | }; 41 | 42 | #endif // INITIALPARTICLE_H 43 | -------------------------------------------------------------------------------- /model/latticeboltzmann/boundary/dragwallcell.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef DRAGWALLCELL_H 20 | #define DRAGWALLCELL_H 21 | 22 | #include "wallcell.h" 23 | #include "../../../model/math/myvector3d.h" 24 | 25 | class DragWallCell : public WallCell { 26 | public: 27 | DragWallCell(); 28 | void activate(QXmlStreamReader &reader, Grid *grid); 29 | void passivate(QXmlStreamWriter &writer); 30 | void setNextF(int index, double value, int component); 31 | void update(); 32 | MyVector3D getDragForce(Grid *grid, Vector3i position); 33 | void setIndex(int index); 34 | int getIndex(); 35 | private: 36 | int index; 37 | }; 38 | 39 | #endif // DRAGWALLCELL_H 40 | -------------------------------------------------------------------------------- /model/latticeboltzmann/porouscell.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef POROUSCELL_H 20 | #define POROUSCELL_H 21 | 22 | #include "sccell.h" 23 | 24 | class PorousCell : public SCCell { 25 | public: 26 | PorousCell(double p0); 27 | void postUpdate(Grid *grid, Vector3i position); 28 | virtual void passivate(QXmlStreamWriter &writer); 29 | virtual void activate(QXmlStreamReader &reader, Grid *grid); 30 | int getOpenCLType(); 31 | double getSolidDensity(); 32 | void setSolidDensity(double solidDensity); 33 | virtual BaseCell* clone(); 34 | void setIndex(int index); 35 | private: 36 | double solidDensity; 37 | int index; 38 | }; 39 | 40 | #endif // POROUSCELL_H 41 | -------------------------------------------------------------------------------- /model/latticeboltzmann/streamline/streamlinegenerator.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "streamlinegenerator.h" 20 | #include "streamlinealgorithm.h" 21 | 22 | StreamLineGenerator::StreamLineGenerator(Grid *grid) : grid(grid) { 23 | } 24 | 25 | std::map StreamLineGenerator::getProperties() { 26 | return properties; 27 | } 28 | 29 | void StreamLineGenerator::setProperty(QString name, QString value) { 30 | properties[name] = value; 31 | propertySetted(name, value); 32 | } 33 | 34 | void StreamLineGenerator::propertySetted(QString , QString ) { 35 | } 36 | 37 | void StreamLineGenerator::injectAlgorithm(StreamLineAlgorithm *algorithm) { 38 | this->algorithm = algorithm; 39 | } 40 | -------------------------------------------------------------------------------- /view/animation.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef ANIMATION_H 20 | #define ANIMATION_H 21 | 22 | #include 23 | class View; 24 | class View2; 25 | 26 | namespace Ui { 27 | class Animation; 28 | } 29 | 30 | class Animation : public QDialog { 31 | Q_OBJECT 32 | public: 33 | explicit Animation(QWidget *parent = 0); 34 | ~Animation(); 35 | void inject(View *view); 36 | void inject(View2 *view2); 37 | private slots: 38 | void on_start_clicked(); 39 | void run(); 40 | void on_stop_clicked(); 41 | private: 42 | int normalize(int angle); 43 | QTimer *timer; 44 | View *view; 45 | View2 *view2; 46 | Ui::Animation *ui; 47 | }; 48 | 49 | #endif // ANIMATION_H 50 | -------------------------------------------------------------------------------- /model/latticeboltzmann/extra/particle.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef PARTICLE_H 20 | #define PARTICLE_H 21 | 22 | #include "../../../model/math/vector3i.h" 23 | #include "../../../model/math/myvector3d.h" 24 | class QXmlStreamReader; 25 | class QXmlStreamWriter; 26 | 27 | class Particle { 28 | public: 29 | Particle(MyVector3D position, Vector3i color, int id, MyVector3D previousPosition); 30 | ~Particle(); 31 | Particle* clone(); 32 | MyVector3D getPosition(); 33 | Vector3i getColor(); 34 | MyVector3D getPreviousPosition(); 35 | int getId(); 36 | private: 37 | MyVector3D position; 38 | Vector3i color; 39 | int id; 40 | MyVector3D previousPosition; 41 | }; 42 | 43 | #endif // PARTICLE_H 44 | -------------------------------------------------------------------------------- /model/latticeboltzmann/moving/somethingmoving.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef SOMETHINGMOVING_H 20 | #define SOMETHINGMOVING_H 21 | 22 | #include "../../../model/math/myvector3d.h" 23 | #include "../../../model/latticeboltzmann/basecell.h" 24 | 25 | class SomethingMoving { 26 | public: 27 | virtual void preUpdate(double epsilon[], BaseCell* neighbors[], Grid *grid, Vector3i position) = 0; 28 | virtual void update() = 0; 29 | virtual MyVector3D getD() = 0; 30 | virtual MyVector3D getVelocity() = 0; 31 | virtual void passivate(QXmlStreamWriter &writer) = 0; 32 | virtual void activate(QXmlStreamReader &reader) = 0; 33 | virtual SomethingMoving* clone() = 0; 34 | }; 35 | 36 | #endif // SOMETHINGMOVING_H 37 | -------------------------------------------------------------------------------- /model/math/myquaternion.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef QUATERNION_H 20 | #define QUATERNION_H 21 | 22 | class MyQuaternion { 23 | public: 24 | MyQuaternion(); 25 | MyQuaternion(float a, float b, float c, float d); 26 | void operator=(const MyQuaternion &operand); 27 | MyQuaternion operator*(const MyQuaternion &operand) const; 28 | MyQuaternion complement() const; 29 | MyQuaternion rotate(const MyQuaternion &rotation) const; 30 | MyQuaternion normalize(); 31 | void rotationMatrix(float matrix[16]); 32 | float value(unsigned int index); 33 | double getRoll(); 34 | double getPitch(); 35 | double getYaw(); 36 | private: 37 | float a, b, c, d; 38 | }; 39 | 40 | #endif // QUATERNION_H 41 | -------------------------------------------------------------------------------- /view/interpolation.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef INTERPOLATION_H 20 | #define INTERPOLATION_H 21 | 22 | #include 23 | class Grid; 24 | class QXmlStreamWriter; 25 | class QXmlStreamReader; 26 | 27 | namespace Ui { 28 | class Interpolation; 29 | } 30 | 31 | class Interpolation : public QDialog { 32 | Q_OBJECT 33 | public: 34 | explicit Interpolation(Grid *grid, QWidget *parent = 0); 35 | ~Interpolation(); 36 | void save(QXmlStreamWriter &writer); 37 | void load(QXmlStreamReader &reader); 38 | private slots: 39 | void on_addLine_clicked(); 40 | void on_removeLine_clicked(); 41 | 42 | private: 43 | Ui::Interpolation *ui; 44 | Grid *grid; 45 | }; 46 | 47 | #endif // INTERPOLATION_H 48 | -------------------------------------------------------------------------------- /model/latticeboltzmann/lbutil.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef LBUTIL_H 20 | #define LBUTIL_H 21 | 22 | class MyVector3D; 23 | class Vector3i; 24 | class BaseCell; 25 | 26 | class LBUtil { 27 | public: 28 | static void f_eq(const MyVector3D &u, double p, int model, double f[]); 29 | static double f_eq(const MyVector3D &u, double p, int model, int index); 30 | static double f_eq2(const MyVector3D &u, double p, int model, int index); 31 | static void calc_pu(double f[], int model, double *p, MyVector3D *u); 32 | static void stream(int model, BaseCell* neighbors[], double nextF[]); 33 | static Vector3i C[28][27]; 34 | static double W[28][27]; 35 | static int OPPOSITE[28][27]; 36 | }; 37 | 38 | #endif // LBUTIL_H 39 | -------------------------------------------------------------------------------- /model/latticeboltzmann/moving/movingwall.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef MOVINGWALL_H 20 | #define MOVINGWALL_H 21 | 22 | #include "somethingmoving.h" 23 | 24 | class MovingWall : public SomethingMoving { 25 | public: 26 | MovingWall(MyVector3D velocity); 27 | void preUpdate(double epsilon[], BaseCell* neighbors[], Grid *grid, Vector3i position); 28 | void update(); 29 | MyVector3D getD(); 30 | MyVector3D getVelocity(); 31 | void configVelocity(MyVector3D velocity); 32 | void configPeriod(int period); 33 | void passivate(QXmlStreamWriter &writer); 34 | void activate(QXmlStreamReader &reader); 35 | SomethingMoving* clone(); 36 | private: 37 | MyVector3D velocity; 38 | int period, current; 39 | }; 40 | 41 | #endif // MOVINGWALL_H 42 | -------------------------------------------------------------------------------- /view/mesher.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef MESHER_H 20 | #define MESHER_H 21 | 22 | #include 23 | class LBWidget; 24 | class Parameters2; 25 | 26 | namespace Ui { 27 | class Mesher; 28 | } 29 | 30 | class Mesher : public QDialog { 31 | Q_OBJECT 32 | public: 33 | explicit Mesher(QWidget *parent = 0); 34 | void injectWidget(LBWidget *widget); 35 | void injectParameters(Parameters2 *parameters); 36 | ~Mesher(); 37 | private slots: 38 | void on_changeCells_clicked(); 39 | void on_resizeGeometry_clicked(); 40 | void on_optimize_clicked(); 41 | void on_porous_clicked(); 42 | void on_newGrid_clicked(); 43 | private: 44 | Ui::Mesher *ui; 45 | LBWidget *widget; 46 | Parameters2 *parameters; 47 | }; 48 | 49 | #endif // MESHER_H 50 | -------------------------------------------------------------------------------- /model/latticeboltzmann/streamline/euler.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "euler.h" 20 | #include "velocityevaluator.h" 21 | #include "../../../model/math/myvector3d.h" 22 | #include "../../../model/latticeboltzmann/streamline/velocitylinearinterpolator.h" 23 | #include "../../../model/latticeboltzmann/streamline/nearestpointvelocityevaluator.h" 24 | 25 | Euler::Euler(double integrationStep) : integrationStep(integrationStep) { 26 | ve = new NearestPointVelocityEvaluator(); 27 | } 28 | 29 | Euler::~Euler() { 30 | delete ve; 31 | } 32 | 33 | MyVector3D Euler::nextPoint(MyVector3D point, Grid *grid) { 34 | return point + (ve->evaluate(point, grid) ^ integrationStep); 35 | } 36 | 37 | void Euler::setIntegrationStep(double integrationStep) { 38 | this->integrationStep = integrationStep; 39 | } 40 | -------------------------------------------------------------------------------- /model/latticeboltzmann/extra/particle.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "particle.h" 20 | #include 21 | #include 22 | 23 | Particle::Particle(MyVector3D position, Vector3i color, int id, MyVector3D previousPosition) : position(position), color(color), id(id), previousPosition(previousPosition) { 24 | } 25 | 26 | Particle::~Particle() { 27 | } 28 | 29 | Particle* Particle::clone() { 30 | Particle* result = new Particle(position, color, id, previousPosition); 31 | return result; 32 | } 33 | 34 | MyVector3D Particle::getPosition() { 35 | return position; 36 | } 37 | 38 | MyVector3D Particle::getPreviousPosition() { 39 | return previousPosition; 40 | } 41 | 42 | Vector3i Particle::getColor() { 43 | return color; 44 | } 45 | 46 | int Particle::getId() { 47 | return id; 48 | } 49 | -------------------------------------------------------------------------------- /model/latticeboltzmann/extra/startingparticle.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef STARTINGPARTICLE_H 20 | #define STARTINGPARTICLE_H 21 | 22 | #include "../../../model/math/vector3i.h" 23 | class Particle; 24 | #include 25 | class QXmlStreamWriter; 26 | class QXmlStreamReader; 27 | class InitialParticle; 28 | 29 | class StartingParticle { 30 | public: 31 | StartingParticle(int id, Vector3i from, Vector3i to, Vector3i color, Vector3i color2); 32 | std::list createParticles(int gridSpacing); 33 | void passivate(QXmlStreamWriter &writer); 34 | void activate(QXmlStreamReader &reader); 35 | int getId(); 36 | Vector3i getFrom(); 37 | Vector3i getTo(); 38 | Vector3i getColor(); 39 | private: 40 | int id; 41 | Vector3i from, to, color, color2; 42 | }; 43 | 44 | #endif // STARTINGPARTICLE_H 45 | -------------------------------------------------------------------------------- /model/latticeboltzmann/streamline/streamlinegenerator.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef STREAMLINEGENERATOR_H 20 | #define STREAMLINEGENERATOR_H 21 | 22 | #include 23 | class StreamLineCurve; 24 | class Grid; 25 | #include 26 | #include 27 | class StreamLineAlgorithm; 28 | 29 | class StreamLineGenerator { 30 | public: 31 | StreamLineGenerator(Grid *grid); 32 | virtual std::list* generate() = 0; 33 | std::map getProperties(); 34 | void setProperty(QString name, QString value); 35 | void injectAlgorithm(StreamLineAlgorithm *algorithm); 36 | protected: 37 | virtual void propertySetted(QString name, QString value); 38 | Grid *grid; 39 | std::map properties; 40 | StreamLineAlgorithm *algorithm; 41 | }; 42 | 43 | #endif // STREAMLINEGENERATOR_H 44 | -------------------------------------------------------------------------------- /model/latticeboltzmann/interpolation/interpolationcell.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef INTERPOLATIONCELL_H 20 | #define INTERPOLATIONCELL_H 21 | 22 | #include "../../../model/latticeboltzmann/boundary/wallcell.h" 23 | 24 | class InterpolationCell : public WallCell { 25 | public: 26 | InterpolationCell(double density, double variation, int period); 27 | void preUpdate(double epsilon[], BaseCell *neighbors[], Grid *grid, Vector3i position); 28 | void preUpdate2(double epsilon[], BaseCell *neighbors[], Grid *grid, Vector3i position); 29 | void setNextF(int index, double value, int component); 30 | int getOpenCLType(); 31 | void passivate(QXmlStreamWriter &writer); 32 | void activate(QXmlStreamReader &reader, Grid *grid); 33 | private: 34 | double density, variation; 35 | int period; 36 | }; 37 | 38 | #endif // INTERPOLATIONCELL_H 39 | -------------------------------------------------------------------------------- /model/latticeboltzmann/streamline/nextcellevalutor.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "nextcellevalutor.h" 20 | #include "velocityevaluator.h" 21 | #include "../../../model/math/myvector3d.h" 22 | #include "nearestpointvelocityevaluator.h" 23 | 24 | NextCellEvalutor::NextCellEvalutor() { 25 | ve = new NearestPointVelocityEvaluator(); 26 | } 27 | 28 | NextCellEvalutor::~NextCellEvalutor() { 29 | delete ve; 30 | } 31 | 32 | MyVector3D NextCellEvalutor::nextPoint(MyVector3D point, Grid *grid) { 33 | MyVector3D v = ve->evaluate(point, grid); 34 | int px = point.getX(); 35 | int py = point.getY(); 36 | int pz = point.getZ(); 37 | MyVector3D n = point + v; 38 | int count = 0; 39 | while ((int)n.getX() == px && (int)n.getY() == py && (int)n.getZ() == pz && ++count < 1000) { 40 | n = n + v; 41 | } 42 | return n; 43 | } 44 | -------------------------------------------------------------------------------- /model/latticeboltzmann/passivescalar/configuration.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef CONFIGURATION_H 20 | #define CONFIGURATION_H 21 | 22 | #include "../../../model/math/vector3i.h" 23 | class QXmlStreamWriter; 24 | class QXmlStreamReader; 25 | class Grid; 26 | 27 | class Configuration { 28 | public: 29 | Configuration(); 30 | Configuration(int id, int minx, int maxx, int miny, int maxy, int minz, int maxz, Vector3i color); 31 | int getId(); 32 | int getMinX(); 33 | int getMaxX(); 34 | int getMinY(); 35 | int getMaxY(); 36 | int getMinZ(); 37 | int getMaxZ(); 38 | Vector3i getColor(); 39 | void passivate(QXmlStreamWriter &writer); 40 | void activate(QXmlStreamReader &reader, Grid *grid); 41 | private: 42 | int id, minx, maxx, miny, maxy, minz, maxz; 43 | Vector3i color; 44 | }; 45 | 46 | #endif // CONFIGURATION_H 47 | -------------------------------------------------------------------------------- /view/util/scrolldecorator.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "scrolldecorator.h" 20 | #include 21 | #include 22 | 23 | ScrollDecorator::ScrollDecorator(QDockWidget *dockWidget, int minWidth, int minHeight, QWidget *parent, QString title) : QDockWidget(title, parent, Qt::SubWindow) { 24 | this->dockWidget = dockWidget; 25 | dockWidget->setFeatures(QDockWidget::NoDockWidgetFeatures); 26 | scrollArea = new QScrollArea(); 27 | scrollArea->setWidget(dockWidget); 28 | scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); 29 | this->setWidget(scrollArea); 30 | this->minWidth = minWidth; 31 | this->minHeight = minHeight; 32 | } 33 | 34 | QSize ScrollDecorator::minimumSizeHint() const { 35 | return QSize(minWidth, minHeight); 36 | } 37 | 38 | ScrollDecorator::~ScrollDecorator() { 39 | delete scrollArea; 40 | } 41 | -------------------------------------------------------------------------------- /view/painter/camera.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef CAMERA_H 20 | #define CAMERA_H 21 | 22 | #include "../../model/math/myquaternion.h" 23 | #include "../../model/math/myvector3d.h" 24 | 25 | class Camera { 26 | public: 27 | Camera(); 28 | void resize(int w, int h, double dz = 0); 29 | void rotate(const MyVector3D from, const MyVector3D to); 30 | void translate(const MyVector3D d); 31 | void prePaint(); 32 | void postPaint(); 33 | void reset(); 34 | double getZoom(); 35 | void setZoom(double zoom); 36 | void setEuler(int roll, int pitch, int yaw); 37 | void setTranslation(const MyVector3D d); 38 | void setTranslation(double x, double y, double z); 39 | MyVector3D getTranslation(); 40 | MyQuaternion getRotation(); 41 | private: 42 | MyQuaternion rotation; 43 | double zoom; 44 | int w, h; 45 | MyVector3D translation; 46 | }; 47 | 48 | #endif // CAMERA_H 49 | -------------------------------------------------------------------------------- /view/util/historylineedit.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "historylineedit.h" 20 | #include 21 | #include 22 | 23 | HistoryLineEdit::HistoryLineEdit(QWidget *parent) : QLineEdit(parent) { 24 | connect(this, SIGNAL(returnPressed()), this, SLOT(returnPressed())); 25 | pointer = -1; 26 | } 27 | 28 | void HistoryLineEdit::keyPressEvent(QKeyEvent *event) { 29 | if (event->key() == Qt::Key_Up) { 30 | if (pointer > 0) { 31 | pointer--; 32 | this->setText(history.at(pointer)); 33 | } 34 | } else if (event->key() == Qt::Key_Down) { 35 | if (pointer < history.size() - 1) { 36 | pointer++; 37 | this->setText(history.at(pointer)); 38 | } 39 | } 40 | QLineEdit::keyPressEvent(event); 41 | } 42 | 43 | void HistoryLineEdit::returnPressed() { 44 | history << this->text(); 45 | pointer = history.size(); 46 | } 47 | -------------------------------------------------------------------------------- /view/util/singleton.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef SINGLETON_H 20 | #define SINGLETON_H 21 | 22 | #include 23 | class QMutex; 24 | class ConsoleDialog; 25 | class Parameters; 26 | class PainterConfig; 27 | 28 | class Singleton { 29 | public: 30 | static Singleton* instance(); 31 | static QString adjustPath(QString path); 32 | void setConsole(ConsoleDialog *console); 33 | ConsoleDialog* getConsole(); 34 | QMutex* getRenderMutex(); 35 | void setParameters(Parameters *parameters); 36 | Parameters* getParameters(); 37 | void setFolder(QString folder); 38 | QString getFolder(); 39 | void setPainterConfig(PainterConfig *painterConfig); 40 | PainterConfig* getPainterConfig(); 41 | private: 42 | Singleton(); 43 | ConsoleDialog *console; 44 | QMutex *renderMutex; 45 | Parameters *parameters; 46 | PainterConfig *painterConfig; 47 | QString folder; 48 | }; 49 | 50 | #endif // SINGLETON_H 51 | -------------------------------------------------------------------------------- /model/latticeboltzmann/force/passivescalarforce.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef PASSIVESCALARFORCE_H 20 | #define PASSIVESCALARFORCE_H 21 | 22 | #include "../../../model/latticeboltzmann/force/force.h" 23 | 24 | class PassiveScalarForce : public Force { 25 | public: 26 | PassiveScalarForce(double strengthX, double strengthY, int minx, int maxx, int miny, int maxy, int period); 27 | MyVector3D computeForce(BaseCell *lattice, BaseCell* neighbors[], int index, int x, int y, int z, Grid *grid); 28 | bool hasEffect(); 29 | void passivate(QXmlStreamWriter &writer); 30 | void activate(QXmlStreamReader &reader, Grid *grid); 31 | double getStrengthX(); 32 | double getStrengthY(); 33 | int getMinX(); 34 | int getMaxX(); 35 | int getMinY(); 36 | int getMaxY(); 37 | int getPeriod(); 38 | private: 39 | double strengthX, strengthY; 40 | int minx, maxx, miny, maxy; 41 | int period; 42 | }; 43 | 44 | #endif // PASSIVESCALARFORCE_H 45 | -------------------------------------------------------------------------------- /model/latticeboltzmann/passivescalar/momentpropagationcell.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef MOMENTPROPAGATIONCELL_H 20 | #define MOMENTPROPAGATIONCELL_H 21 | 22 | #include "passivescalarcell.h" 23 | 24 | class MomentPropagationCell : public PassiveScalarCell { 25 | public: 26 | MomentPropagationCell(BaseCell *cell, double fixedConcentration, int index); 27 | void initializeDistribution(); 28 | void calc(); 29 | void reset(int id); 30 | void reset(double p0, double p1); 31 | void preUpdate(double epsilon[], BaseCell *neighbors[], Grid *grid, Vector3i position); 32 | void preUpdate2(double epsilon[], BaseCell *neighbors[], Grid *grid, Vector3i position); 33 | void update(); 34 | double getF(int index, int component); 35 | void setNextF(int index, double value, int component); 36 | void passivate(QXmlStreamWriter &writer); 37 | void activate(QXmlStreamReader &reader, Grid *grid); 38 | }; 39 | 40 | #endif // MOMENTPROPAGATIONCELL_H 41 | -------------------------------------------------------------------------------- /model/listener/listenerdata.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef LISTENERDATA_H 20 | #define LISTENERDATA_H 21 | 22 | class ListenerData { 23 | public: 24 | ListenerData(int width, int height, int length, long iterations, double particles, double deltaP, double deltaDeltaP, double averageP); 25 | static ListenerData createIterations(long iterations, double particles, double deltaP, double deltaDeltaP, double averageP); 26 | static ListenerData createSize(int width, int height, int length); 27 | long getIterations() const; 28 | double getParticles() const; 29 | int getWidth() const; 30 | int getHeight() const; 31 | int getLength() const; 32 | double getDeltaP() const; 33 | double getDeltaDeltaP() const; 34 | double getAverageP() const; 35 | private: 36 | int width, height, length; 37 | long iterations; 38 | double particles; 39 | double deltaP, deltaDeltaP; 40 | double averageP; 41 | }; 42 | 43 | #endif // LISTENERDATA_H 44 | -------------------------------------------------------------------------------- /model/latticeboltzmann/boundary/reflectwithfactorcell.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "reflectwithfactorcell.h" 20 | #include "../../util/shared.h" 21 | #include "../../latticeboltzmann/gridconfig.h" 22 | #include "../../latticeboltzmann/lbutil.h" 23 | #include 24 | 25 | ReflectWithFactorCell::ReflectWithFactorCell() { 26 | } 27 | 28 | int ReflectWithFactorCell::getOpenCLType() { 29 | return 7; 30 | } 31 | 32 | void ReflectWithFactorCell::setNextF(int index, double value, int component) { 33 | int model = Shared::instance()->getGridConfig()->getModel(); 34 | if (neighbors[LBUtil::OPPOSITE[model][index]] != 0) { 35 | neighbors[LBUtil::OPPOSITE[model][index]]->setNextF(LBUtil::OPPOSITE[model][index], value * (component < 10 ? 1 : Shared::instance()->getGridConfig()->getReflectWithFactor()), component); 36 | } 37 | } 38 | 39 | void ReflectWithFactorCell::passivate(QXmlStreamWriter &writer) { 40 | writer.writeAttribute("type", "reflectWithFactor"); 41 | } 42 | -------------------------------------------------------------------------------- /model/math/vector3i.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef VECTOR3I_H 20 | #define VECTOR3I_H 21 | 22 | class MyVector3D; 23 | 24 | class Vector3i { 25 | public: 26 | Vector3i(); 27 | Vector3i(int x, int y, int z); 28 | int getX() const; 29 | int getY() const; 30 | int getZ() const; 31 | double norm(); 32 | void addD(int x, int y, int z, bool periodic, int mx, int my, int mz); 33 | bool isNeighbor(const Vector3i *vector) const; 34 | bool operator==(const Vector3i &a) const; 35 | Vector3i operator+(const Vector3i &v) const; 36 | Vector3i operator-(const Vector3i &v) const; 37 | MyVector3D operator^(const double a) const; 38 | MyVector3D toMyVector3D(); 39 | Vector3i operator^(const int a) const; 40 | double operator*(const MyVector3D &v) const; 41 | Vector3i reflect(int width, int height, int length); 42 | bool bounds(const int width, const int height, const int length) const; 43 | private: 44 | int x, y, z; 45 | }; 46 | 47 | #endif // VECTOR3I_H 48 | -------------------------------------------------------------------------------- /model/inputoutput/loaderfromimage.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef LOADERFROMIMAGE_H 20 | #define LOADERFROMIMAGE_H 21 | 22 | class QString; 23 | class Grid; 24 | #include 25 | 26 | class LoaderFromImage { 27 | public: 28 | static void load(Grid *grid, QString &fileName, QString flags = ""); 29 | static void save(Grid *grid, QString &fileName, int scale = 1); 30 | static QColor null; 31 | static QColor porous; 32 | static QColor moving; 33 | static QColor open; 34 | static QColor source; 35 | static QColor movingWall; 36 | static QColor wall; 37 | static QColor negative; 38 | static QColor positive; 39 | static QColor shallow; 40 | static QColor point; 41 | static QColor thermal; 42 | static QColor dragWall; 43 | static QColor slipWall; 44 | static QColor depositionWall; 45 | static QColor reflectWithFactor; 46 | static QColor kornerSolid, kornerLiquid, kornerGas, kornerInterface, kornerWall; 47 | }; 48 | 49 | #endif // LOADERFROMIMAGE_H 50 | -------------------------------------------------------------------------------- /model/latticeboltzmann/force/gravity.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "gravity.h" 20 | #include 21 | #include "../../../model/math/myvector3d.h" 22 | #include "../../../model/latticeboltzmann/lbgrid.h" 23 | #include "../../../model/latticeboltzmann/gridconfig.h" 24 | #include "../../../model/latticeboltzmann/basecell.h" 25 | #include "../../../model/util/shared.h" 26 | 27 | Gravity::Gravity() { 28 | } 29 | 30 | MyVector3D Gravity::computeForce(BaseCell *empty, BaseCell*[], int index, int, int, int, Grid*) { 31 | GridConfig *config = Shared::instance()->getGridConfig(); 32 | return MyVector3D(0, -config->getGravity(), 0) ^ (empty->getP(-1) * (index == 0 ? config->getDensity1() : config->getDensity2())); 33 | } 34 | 35 | bool Gravity::hasEffect() { 36 | GridConfig *config = Shared::instance()->getGridConfig(); 37 | return std::abs(config->getGravity()) > 1e-100; 38 | } 39 | 40 | void Gravity::passivate(QXmlStreamWriter&) { 41 | } 42 | 43 | void Gravity::activate(QXmlStreamReader&, Grid*) { 44 | } 45 | -------------------------------------------------------------------------------- /model/latticeboltzmann/gridsimulation.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef GRIDSIMULATION_H 20 | #define GRIDSIMULATION_H 21 | 22 | class QXmlStreamWriter; 23 | class QXmlStreamReader; 24 | 25 | class GridSimulation { 26 | public: 27 | GridSimulation(); 28 | void resetIterations(); 29 | long addIteration(int steps = 1); 30 | long getIterations(); 31 | void addDeltasP(); 32 | void removeDeltasP(); 33 | int getDeltasP(); 34 | void resetDeltasP(); 35 | void resetDeltaP(); 36 | void addDeltaP(double deltaP); 37 | void calcDeltaP(); 38 | double getDeltaP(); 39 | void resetTotalP(); 40 | void addTotalP(double totalP); 41 | double getTotalP(); 42 | void setPerformance(double performance); 43 | double getPerformance(); 44 | void passivate(QXmlStreamWriter &writer); 45 | void activate(QXmlStreamReader &reader); 46 | private: 47 | long iterations; 48 | int deltasP; 49 | double deltaP; 50 | double totalP; 51 | double performance; 52 | }; 53 | 54 | #endif // GRIDSIMULATION_H 55 | -------------------------------------------------------------------------------- /model/latticeboltzmann/nullcell.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef NULLCELL_H 20 | #define NULLCELL_H 21 | 22 | #include "basecell.h" 23 | #include 24 | 25 | class NullCell : public BaseCell { 26 | public: 27 | NullCell(); 28 | void preUpdate(double epsilon[], BaseCell* neighbors[], Grid *grid, Vector3i position); 29 | void preUpdate2(double epsilon[], BaseCell* neighbors[], Grid *grid, Vector3i position); 30 | void update(); 31 | void postUpdate(Grid *grid, Vector3i position); 32 | void reset(double p0, double p1); 33 | double getF(int index, int component); 34 | void setNextF(int index, double value, int component); 35 | void setMulticomponent(int multicomponent); 36 | void passivate(QXmlStreamWriter &writer); 37 | double getP(int index); 38 | MyVector3D getU(int index); 39 | double deltaP(); 40 | double getLastDeltaP(); 41 | double getNextF(int index, int component); 42 | MyVector3D getForcesVelocity(int component); 43 | bool isFluid(); 44 | int getOpenCLType(); 45 | }; 46 | 47 | #endif // NULLCELL_H 48 | -------------------------------------------------------------------------------- /view/colors.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef COLORS_H 20 | #define COLORS_H 21 | 22 | #include 23 | class QXmlStreamWriter; 24 | class QXmlStreamReader; 25 | 26 | namespace Ui { 27 | class Colors; 28 | } 29 | 30 | class Painter; 31 | class LBWidget; 32 | 33 | class Colors : public QDialog { 34 | Q_OBJECT 35 | public: 36 | Colors(LBWidget *widget, QWidget *parent = 0); 37 | ~Colors(); 38 | void config(double average, double interval); 39 | void save(QXmlStreamWriter &writer); 40 | void load(QXmlStreamReader &reader); 41 | protected: 42 | void changeEvent(QEvent *e); 43 | private: 44 | LBWidget *widget; 45 | Ui::Colors *ui; 46 | double average, interval; 47 | private slots: 48 | void on_x_returnPressed(); 49 | void on_y_returnPressed(); 50 | void on_width_returnPressed(); 51 | void on_height_returnPressed(); 52 | void on_captionX_returnPressed(); 53 | void on_captionY_returnPressed(); 54 | void on_captionPt_returnPressed(); 55 | void on_colorStyle_currentIndexChanged(int index); 56 | }; 57 | 58 | #endif // COLORS_H 59 | -------------------------------------------------------------------------------- /model/latticeboltzmann/streamline/nearestpointvelocityevaluator.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "nearestpointvelocityevaluator.h" 20 | #include "../../../model/math/myvector3d.h" 21 | #include 22 | #include "../../../model/latticeboltzmann/lbgrid.h" 23 | #include "../../../model/latticeboltzmann/basecell.h" 24 | 25 | NearestPointVelocityEvaluator::NearestPointVelocityEvaluator() { 26 | } 27 | 28 | MyVector3D NearestPointVelocityEvaluator::evaluate(MyVector3D point, Grid *grid) { 29 | int x = (int)ceil(point.getX()); 30 | if (point.getX() - floor(point.getX()) < ceil(point.getX()) - point.getX()) { 31 | x = floor(point.getX()); 32 | } 33 | int y = (int)ceil(point.getY()); 34 | if (point.getY() - floor(point.getY()) < ceil(point.getY()) - point.getY()) { 35 | y = floor(point.getY()); 36 | } 37 | int z = (int)ceil(point.getZ()); 38 | if (point.getZ() - floor(point.getZ()) < ceil(point.getZ()) - point.getZ()) { 39 | z = floor(point.getZ()); 40 | } 41 | BaseCell *cell = grid->getGrid(y, x, z); 42 | if (cell == 0) { 43 | return MyVector3D(); 44 | } 45 | return cell->getU(0); 46 | } 47 | -------------------------------------------------------------------------------- /model/latticeboltzmann/meltingsolidification/meltingsolidificationcell.h: -------------------------------------------------------------------------------- 1 | #ifndef MELTINGSOLIDIFICATIONCELL_H 2 | #define MELTINGSOLIDIFICATIONCELL_H 3 | 4 | #include "../basecell.h" 5 | #include "../../math/myvector3d.h" 6 | class KornerImplementation; 7 | 8 | class MeltingSolidificationCell : public BaseCell { 9 | public: 10 | MeltingSolidificationCell(KornerImplementation *ki); 11 | void preUpdate(double epsilon[], BaseCell* neighbors[], Grid *grid, Vector3i position); 12 | void preUpdate2(double epsilon[], BaseCell* neighbors[], Grid *grid, Vector3i position); 13 | void update(); 14 | void postUpdate(Grid *grid, Vector3i position); 15 | void reset(double p0, double p1); 16 | double getF(int index, int component); 17 | void setNextF(int index, double value, int component); 18 | void setMulticomponent(int multicomponent); 19 | void passivate(QXmlStreamWriter &writer); 20 | void activate(QXmlStreamReader &reader, Grid *grid); 21 | double getP(int index); 22 | MyVector3D getU(int index); 23 | double deltaP(); 24 | double getLastDeltaP(); 25 | double getNextF(int index, int component); 26 | MyVector3D getForcesVelocity(int component); 27 | bool isFluid(); 28 | int getOpenCLType(); 29 | void updateFromOpenCL(double *data); 30 | BaseCell* clone(); 31 | void setType(char type); 32 | char getType(); 33 | double getCellMass(); 34 | void convertToInterface(char newType); 35 | double getBeamEnergy(); 36 | void setBeamEnergy(double beamEnergy); 37 | double getAbsorbedEnergy(); 38 | void setAbsorbedEnergy(double absorbedEnergy); 39 | private: 40 | double f[9], nextF[9]; 41 | double g[9], nextG[9]; 42 | double cellMass, nextCellMass; 43 | double p, T; 44 | MyVector3D u; 45 | char type; // (I)nterface, (G)as, (L)iquid, (S)olid, (W)all 46 | double beamEnergy; 47 | double absorbedEnergy; 48 | KornerImplementation *ki; 49 | }; 50 | 51 | #endif // MELTINGSOLIDIFICATIONCELL_H 52 | -------------------------------------------------------------------------------- /view/immersed.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | Immersed 4 | 5 | 6 | 7 | 0 8 | 0 9 | 400 10 | 300 11 | 12 | 13 | 14 | Immersed 15 | 16 | 17 | 18 | 19 | 10 20 | 10 21 | 381 22 | 22 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 10 35 | 40 36 | 381 37 | 91 38 | 39 | 40 | 41 | 42 | 43 | 44 | 10 45 | 140 46 | 381 47 | 23 48 | 49 | 50 | 51 | Add 52 | 53 | 54 | 55 | 56 | 57 | 10 58 | 270 59 | 381 60 | 23 61 | 62 | 63 | 64 | Remove 65 | 66 | 67 | 68 | 69 | 70 | 10 71 | 170 72 | 381 73 | 91 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /model/latticeboltzmann/physical/parameters.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef PARAMETERS_H 20 | #define PARAMETERS_H 21 | 22 | class QXmlStreamReader; 23 | class QXmlStreamWriter; 24 | 25 | class Parameters { 26 | public: 27 | Parameters(); 28 | static double dtValue(double dx, double kinematicViscosity, double epsilon); 29 | void config(double dx, double kinematicViscosity, double epsilon); 30 | void setDM(double dm); 31 | double dimentionalVelocity(double velocity); 32 | double nondimentionalVelocity(double velocity); 33 | double dimentionalLength(double length); 34 | double nondimentionalLength(double length); 35 | double dimentionalTime(double time); 36 | double nondimentionalTime(double time); 37 | double dimentionalViscosity(double viscosity); 38 | double nondimentionalViscosity(double viscosity); 39 | double dimentionalPressure(double pressure); 40 | double nondimentionalPressure(double pressure); 41 | void passivate(QXmlStreamWriter &writer); 42 | void activate(QXmlStreamReader &reader); 43 | double getDX(); 44 | double getDT(); 45 | double getDM(); 46 | private: 47 | double dx, dt, dm; 48 | }; 49 | 50 | #endif // PARAMETERS_H 51 | -------------------------------------------------------------------------------- /model/latticeboltzmann/multi/fecell.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef FECELL_H 20 | #define FECELL_H 21 | 22 | #include "../../../model/latticeboltzmann/basecell.h" 23 | #include 24 | #include "../../../model/math/myvector3d.h" 25 | 26 | class FECell : public BaseCell { 27 | public: 28 | FECell(); 29 | ~FECell(); 30 | void preUpdate(double epsilon[], BaseCell* neighbors[], Grid *grid, Vector3i position); 31 | void preUpdate2(double epsilon[], BaseCell* neighbors[], Grid *grid, Vector3i position); 32 | void update(); 33 | void postUpdate(Grid *grid, Vector3i position); 34 | void reset(double p0, double p1); 35 | double getF(int index, int component); 36 | void setNextF(int index, double value, int component); 37 | void setMulticomponent(int multicomponent); 38 | double getP(int index); 39 | MyVector3D getU(int index); 40 | double deltaP(); 41 | double getLastDeltaP(); 42 | double getNextF(int index, int component); 43 | MyVector3D getForcesVelocity(int component); 44 | bool isFluid(); 45 | private: 46 | void calc(); 47 | double *f, *g; 48 | double rho, phi; 49 | MyVector3D u; 50 | double p0, p1; 51 | }; 52 | 53 | #endif // FECELL_H 54 | -------------------------------------------------------------------------------- /view/results.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef RESULTS_H 20 | #define RESULTS_H 21 | 22 | class Painter; 23 | #include 24 | class QXmlStreamWriter; 25 | class QXmlStreamReader; 26 | 27 | namespace Ui { 28 | class Results; 29 | } 30 | 31 | class Results : public QDialog { 32 | Q_OBJECT 33 | public: 34 | explicit Results(Painter *painter, QWidget *parent = 0); 35 | ~Results(); 36 | bool getSaveImage(); 37 | bool getReportVelocities(); 38 | int getSaveInterval(); 39 | bool getReportSimulation(); 40 | Ui::Results* getUI(); 41 | void save(QXmlStreamWriter &writer); 42 | void load(QXmlStreamReader &reader); 43 | public slots: 44 | void on_maxSteps_returnPressed(); 45 | //void on_matlabStreamlines_clicked(); 46 | void on_stopCriterion_returnPressed(); 47 | //void on_csvGenerate_clicked(); 48 | //void on_simX_returnPressed(); 49 | //void on_simY_returnPressed(); 50 | //void on_simZ_returnPressed(); 51 | private slots: 52 | void on_addPoint_clicked(); 53 | 54 | void on_removePoint_clicked(); 55 | 56 | void on_updatePoints_clicked(); 57 | 58 | private: 59 | Painter *painter; 60 | Ui::Results *ui; 61 | }; 62 | 63 | #endif // RESULTS_H 64 | -------------------------------------------------------------------------------- /view/painterconfig.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef PAINTERCONFIG_H 20 | #define PAINTERCONFIG_H 21 | 22 | #include 23 | class StreamLineGenerator; 24 | class Painter; 25 | class LBWidget; 26 | 27 | namespace Ui { 28 | class PainterConfig; 29 | } 30 | 31 | class PainterConfig : public QDialog { 32 | Q_OBJECT 33 | public: 34 | explicit PainterConfig(QWidget *parent = 0); 35 | void injectPainter(Painter *painter); 36 | void injectWidget(LBWidget *widget); 37 | int getStreamIntegrationX(); 38 | int getStreamIntegrationY(); 39 | ~PainterConfig(); 40 | private slots: 41 | void on_strategy_currentIndexChanged(int index); 42 | void on_update_clicked(); 43 | void on_equallySpaced_clicked(); 44 | void on_custom_clicked(); 45 | void on_addRow_clicked(); 46 | void on_deleteRow_clicked(); 47 | void on_updateIsolines_clicked(); 48 | void on_streamIntegrationX_currentIndexChanged(int index); 49 | void on_streamIntegrationY_currentIndexChanged(int index); 50 | void on_sortIsolines_clicked(); 51 | 52 | void on_randomIsolines_clicked(); 53 | 54 | private: 55 | Ui::PainterConfig *ui; 56 | Painter *painter; 57 | LBWidget *widget; 58 | }; 59 | 60 | #endif // PAINTERCONFIG_H 61 | -------------------------------------------------------------------------------- /view/view2.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef VIEW2_H 20 | #define VIEW2_H 21 | 22 | #include 23 | class LBWidget; 24 | 25 | namespace Ui { 26 | class View2; 27 | } 28 | 29 | class View2 : public QDialog { 30 | Q_OBJECT 31 | public: 32 | explicit View2(LBWidget *widget, QWidget *parent = 0); 33 | ~View2(); 34 | Ui::View2* getUI(); 35 | private: 36 | Ui::View2 *ui; 37 | LBWidget *widget; 38 | bool fixedX, fixedY, fixedZ; 39 | public slots: 40 | void on_allZ_clicked(); 41 | void on_allY_clicked(); 42 | void on_allX_clicked(); 43 | void on_fixedZ_valueChanged(int value); 44 | void on_maxZ_valueChanged(int value); 45 | void on_minZ_valueChanged(int value); 46 | void on_fixedY_valueChanged(int value); 47 | void on_maxY_valueChanged(int value); 48 | void on_minY_valueChanged(int value); 49 | void on_fixedX_valueChanged(int value); 50 | void on_maxX_valueChanged(int value); 51 | void on_minX_valueChanged(int value); 52 | private slots: 53 | void on_xyPlane_clicked(); 54 | void on_xzPlane_clicked(); 55 | void on_yzPlane_clicked(); 56 | void on_wholePlane1_clicked(); 57 | void on_wholePlane2_clicked(); 58 | void on_wholePlane3_clicked(); 59 | }; 60 | 61 | #endif // VIEW2_H 62 | -------------------------------------------------------------------------------- /lbmain.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include 20 | #include "view/lbmainwindow.h" 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | void myMessageHandler(QtMsgType type, const char *msg) { 29 | QString txt; 30 | switch (type) { 31 | case QtDebugMsg: 32 | txt = QString("Debug: %1").arg(msg); 33 | break; 34 | case QtWarningMsg: 35 | txt = QString("Warning: %1").arg(msg); 36 | break; 37 | case QtCriticalMsg: 38 | txt = QString("Critical: %1").arg(msg); 39 | break; 40 | case QtFatalMsg: 41 | txt = QString("Fatal: %1").arg(msg); 42 | break; 43 | } 44 | QFile outFile("lbsim.log"); 45 | outFile.open(QIODevice::WriteOnly | QIODevice::Append); 46 | QTextStream ts(&outFile); 47 | ts << QDateTime::currentDateTime().toString("dd/MM/yyyy hh:mm:ss") << " " << txt << "\r\n"; 48 | if (type == QtFatalMsg) { 49 | abort(); 50 | } 51 | } 52 | 53 | int main(int argc, char *argv[]) { 54 | QApplication a(argc, argv); 55 | LBMainWindow *w = new LBMainWindow(); 56 | w->showMaximized(); 57 | qsrand(time(0)); 58 | return a.exec(); 59 | } 60 | -------------------------------------------------------------------------------- /model/math/myvector3d.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef VECTOR_H 20 | #define VECTOR_H 21 | 22 | class Vector3i; 23 | class QString; 24 | #include 25 | 26 | class MyVector3D { 27 | public: 28 | MyVector3D(); 29 | MyVector3D(double x, double y, double z); 30 | MyVector3D projection(bool x, bool y, bool z); 31 | MyVector3D projection(Vector3i &v); 32 | MyVector3D periodic(double w, double h, double l); 33 | MyVector3D operator^(const double scalar) const; 34 | MyVector3D operator^(const MyVector3D &a) const; 35 | double operator*(const MyVector3D &a) const; 36 | double operator*(const Vector3i &a) const; 37 | MyVector3D operator+(const MyVector3D &a) const; 38 | MyVector3D operator-(const MyVector3D &a) const; 39 | bool operator==(MyVector3D &a) const; 40 | MyVector3D limit(double limit); 41 | MyVector3D normalize(); 42 | MyVector3D log(); 43 | Vector3i toVector3i(); 44 | MyVector3D rotate2D(MyVector3D center, double rotation); 45 | double distance2(MyVector3D v); 46 | double norm(); 47 | double norm2(); 48 | double getX() const; 49 | double getY() const; 50 | double getZ() const; 51 | std::string toString(); 52 | QString qtString(); 53 | private: 54 | double x; 55 | double y; 56 | double z; 57 | }; 58 | 59 | #endif // VECTOR_H 60 | -------------------------------------------------------------------------------- /view/codeeditor.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | CodeEditor 4 | 5 | 6 | 7 | 0 8 | 0 9 | 800 10 | 600 11 | 12 | 13 | 14 | .lb/.lb2 Editor 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Courier New 23 | 12 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 0 34 | 0 35 | 800 36 | 18 37 | 38 | 39 | 40 | 41 | File 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | Load .lb 55 | 56 | 57 | 58 | 59 | Load .lb2 60 | 61 | 62 | 63 | 64 | Save .lb 65 | 66 | 67 | 68 | 69 | Save .lb2 70 | 71 | 72 | 73 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /model/latticeboltzmann/boundary/extrapolationboundary.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef EXTRAPOLATIONBOUNDARY_H 20 | #define EXTRAPOLATIONBOUNDARY_H 21 | 22 | #include "boundary.h" 23 | 24 | class ExtrapolationBoundary : public Boundary { 25 | public: 26 | ExtrapolationBoundary(); 27 | void preUpdate(double epsilon[], BaseCell* neighbors[], Grid *grid, Vector3i position); 28 | void preUpdate2(double epsilon[], BaseCell* neighbors[], Grid *grid, Vector3i position); 29 | void update(); 30 | void postUpdate(Grid *grid, Vector3i position); 31 | void reset(double p0, double p1); 32 | double getF(int index, int); 33 | void setNextF(int index, double value, int component); 34 | void passivate(QXmlStreamWriter &writer); 35 | void activate(QXmlStreamReader &reader, Grid *grid); 36 | void configPressure(double pressure); 37 | void configVelocity(double velocity); 38 | double getVelocity(); 39 | double getPressure(); 40 | void setMulticomponent(int multicomponent); 41 | double getP(int index); 42 | MyVector3D getU(int index); 43 | double deltaP(); 44 | double getLastDeltaP(); 45 | double getNextF(int index, int component); 46 | MyVector3D getForcesVelocity(int component); 47 | bool isFluid(); 48 | int getOpenCLType(); 49 | }; 50 | 51 | #endif // EXTRAPOLATIONBOUNDARY_H 52 | -------------------------------------------------------------------------------- /model/latticeboltzmann/boundary/zouheboundary.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef ZOUHEBOUNDARY_H 20 | #define ZOUHEBOUNDARY_H 21 | 22 | #include "boundary.h" 23 | 24 | class ZouHeBoundary : public Boundary { 25 | public: 26 | ZouHeBoundary(); 27 | void preUpdate(double epsilon[], BaseCell* neighbors[], Grid *grid, Vector3i position); 28 | void preUpdate2(double epsilon[], BaseCell* neighbors[], Grid *grid, Vector3i position); 29 | void update(); 30 | void postUpdate(Grid *grid, Vector3i position); 31 | void reset(double p0, double p1); 32 | double getF(int index, int); 33 | void configPressure(double pressure); 34 | void configVelocity(double velocity); 35 | double getVelocity(); 36 | double getPressure(); 37 | void passivate(QXmlStreamWriter &writer); 38 | void activate(QXmlStreamReader &reader, Grid *grid); 39 | void setNextF(int index, double value, int component); 40 | void setMulticomponent(int multicomponent); 41 | double getP(int index); 42 | MyVector3D getU(int index); 43 | double deltaP(); 44 | double getLastDeltaP(); 45 | double getNextF(int index, int component); 46 | MyVector3D getForcesVelocity(int component); 47 | bool isFluid(); 48 | int getOpenCLType(); 49 | private: 50 | double pressure, velocity; 51 | }; 52 | 53 | #endif // ZOUHEBOUNDARY_H 54 | -------------------------------------------------------------------------------- /model/latticeboltzmann/boundary/pointboundary.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef POINTBOUNDARY_H 20 | #define POINTBOUNDARY_H 21 | 22 | #include "boundary.h" 23 | #include 24 | 25 | class PointBoundary : public Boundary { 26 | public: 27 | PointBoundary(); 28 | void preUpdate(double epsilon[], BaseCell* neighbors[], Grid *grid, Vector3i position); 29 | void preUpdate2(double epsilon[], BaseCell* neighbors[], Grid *grid, Vector3i position); 30 | void update(); 31 | void postUpdate(Grid *grid, Vector3i position); 32 | void reset(double p0, double p1); 33 | double getF(int index, int component); 34 | void setNextF(int index, double value, int component); 35 | void setMulticomponent(int multicomponent); 36 | void passivate(QXmlStreamWriter &writer); 37 | void activate(QXmlStreamReader &reader, Grid *grid); 38 | double getP(int index); 39 | MyVector3D getU(int index); 40 | double deltaP(); 41 | double getLastDeltaP(); 42 | double getNextF(int index, int component); 43 | MyVector3D getForcesVelocity(int component); 44 | bool isFluid(); 45 | void configPressure(double pressure); 46 | void configVelocity(double velocity); 47 | double getVelocity(); 48 | double getPressure(); 49 | int getOpenCLType(); 50 | private: 51 | double pressure; 52 | }; 53 | 54 | #endif // POINTBOUNDARY_H 55 | -------------------------------------------------------------------------------- /model/latticeboltzmann/boundary/partialslipboundary.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef PARTIALSLIPBOUNDARY_H 20 | #define PARTIALSLIPBOUNDARY_H 21 | 22 | #include "../../../model/latticeboltzmann/basecell.h" 23 | class GridConfig; 24 | #include 25 | 26 | class PartialSlipBoundary : public BaseCell { 27 | public: 28 | PartialSlipBoundary(); 29 | void preUpdate(double epsilon[], BaseCell* neighbors[], Grid *grid, Vector3i position); 30 | void preUpdate2(double epsilon[], BaseCell* neighbors[], Grid *grid, Vector3i position); 31 | void update(); 32 | void postUpdate(Grid *grid, Vector3i position); 33 | void reset(double p0, double p1); 34 | double getF(int index); 35 | void passivate(QXmlStreamWriter &writer); 36 | void setMulticomponent(int multicomponent); 37 | double getF(int index, int component); 38 | double getF0(int index, double epsilon, BaseCell* neighbors[], int component); 39 | void setNextF(int index, double value, int component); 40 | void injectNeighbors(BaseCell** neighbors); 41 | double getP(int index); 42 | MyVector3D getU(int index); 43 | double deltaP(); 44 | double getLastDeltaP(); 45 | double getNextF(int index, int component); 46 | MyVector3D getForcesVelocity(int component); 47 | bool isFluid(); 48 | int getOpenCLType(); 49 | }; 50 | 51 | #endif // PARTIALSLIPBOUNDARY_H 52 | -------------------------------------------------------------------------------- /model/latticeboltzmann/shallow/shallowcell.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef SHALLOWCELL_H 20 | #define SHALLOWCELL_H 21 | 22 | #include "../../../model/latticeboltzmann/basecell.h" 23 | class GridConfig; 24 | #include 25 | #include "../../../model/math/myvector3d.h" 26 | 27 | class ShallowCell : public BaseCell { 28 | public: 29 | ShallowCell(); 30 | void preUpdate(double epsilon[], BaseCell* neighbors[], Grid *grid, Vector3i position); 31 | void preUpdate2(double epsilon[], BaseCell* neighbors[], Grid *grid, Vector3i position); 32 | void update(); 33 | void postUpdate(Grid *grid, Vector3i position); 34 | void reset(double p0, double p1); 35 | double getF(int index, int component); 36 | void setNextF(int index, double value, int component); 37 | void setMulticomponent(int multicomponent); 38 | void passivate(QXmlStreamWriter &writer); 39 | void activate(QXmlStreamReader &reader, Grid *grid); 40 | double getP(int index); 41 | MyVector3D getU(int index); 42 | double deltaP(); 43 | double getLastDeltaP(); 44 | double getNextF(int index, int component); 45 | MyVector3D getForcesVelocity(int component); 46 | bool isFluid(); 47 | int getOpenCLType(); 48 | private: 49 | void calc(); 50 | double f[9], nextF[9]; 51 | double h; 52 | MyVector3D u; 53 | double p0; 54 | }; 55 | 56 | #endif // SHALLOWCELL_H 57 | -------------------------------------------------------------------------------- /view/imageprocessing.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef IMAGEPROCESSING_H 20 | #define IMAGEPROCESSING_H 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | namespace Ui { 27 | class ImageProcessing; 28 | } 29 | 30 | class ImageProcessing : public QMainWindow { 31 | Q_OBJECT 32 | public: 33 | explicit ImageProcessing(QWidget *parent = 0); 34 | ~ImageProcessing(); 35 | private slots: 36 | void on_actionOpen_triggered(); 37 | void on_defaultColor_clicked(); 38 | void on_fromColor_clicked(); 39 | void on_toColor_clicked(); 40 | void on_add_clicked(); 41 | void on_colors_clicked(const QModelIndex &index); 42 | void on_remove_clicked(); 43 | void on_actionOnly_Left_triggered(); 44 | void on_actionOnly_Right_triggered(); 45 | void on_actionAll_triggered(); 46 | void on_tolerance_returnPressed(); 47 | void on_actionSave_triggered(); 48 | 49 | void on_average_returnPressed(); 50 | 51 | private: 52 | void process(); 53 | Ui::ImageProcessing *ui; 54 | QImage fromImage, toImage; 55 | QColor defaultColor, fromColor, toColor; 56 | std::map fromColors; 57 | std::map toColors; 58 | int counter; 59 | QStringListModel *stringListModel; 60 | QStringList stringList; 61 | QByteArray initialState; 62 | }; 63 | 64 | #endif // IMAGEPROCESSING_H 65 | -------------------------------------------------------------------------------- /model/latticeboltzmann/deposition/depositioncell.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef DEPOSITIONCELL_H 20 | #define DEPOSITIONCELL_H 21 | 22 | #include "../../../model/latticeboltzmann/basecell.h" 23 | #include 24 | 25 | class DepositionCell : public BaseCell { 26 | public: 27 | DepositionCell(); 28 | void preUpdate(double epsilon[], BaseCell* neighbors[], Grid *grid, Vector3i position); 29 | void preUpdate2(double epsilon[], BaseCell* neighbors[], Grid *grid, Vector3i position); 30 | void update(); 31 | void postUpdate(Grid *grid, Vector3i position); 32 | void reset(double p0, double p1); 33 | double getF(int index, int component); 34 | void setNextF(int index, double value, int component); 35 | void setMulticomponent(int multicomponent); 36 | void passivate(QXmlStreamWriter &writer); 37 | void activate(QXmlStreamReader &reader, Grid *grid); 38 | double getP(int index); 39 | MyVector3D getU(int index); 40 | double deltaP(); 41 | double getLastDeltaP(); 42 | double getNextF(int index, int component); 43 | MyVector3D getForcesVelocity(int component); 44 | bool isFluid(); 45 | int getOpenCLType(); 46 | void updateFromOpenCL(double *data); 47 | private: 48 | void calcConcentration(); 49 | double g[9], nextG[9]; 50 | double deposited; 51 | double concentration, initialConcentration; 52 | }; 53 | 54 | #endif // DEPOSITIONCELL_H 55 | -------------------------------------------------------------------------------- /model/latticeboltzmann/thermal/thermalwall.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef THERMALWALL_H 20 | #define THERMALWALL_H 21 | 22 | #include "../../../model/latticeboltzmann/basecell.h" 23 | class GridConfig; 24 | #include 25 | 26 | class ThermalWall : public BaseCell { 27 | public: 28 | ThermalWall(); 29 | void preUpdate(double epsilon[], BaseCell* neighbors[], Grid *grid, Vector3i position); 30 | void preUpdate2(double epsilon[], BaseCell* neighbors[], Grid *grid, Vector3i position); 31 | void update(); 32 | void postUpdate(Grid *grid, Vector3i position); 33 | void reset(double p0, double p1); 34 | double getF(int index, int component); 35 | void setNextF(int index, double value, int component); 36 | void setMulticomponent(int multicomponent); 37 | void passivate(QXmlStreamWriter &writer); 38 | void activate(QXmlStreamReader &reader, Grid *grid); 39 | double getP(int index); 40 | MyVector3D getU(int index); 41 | double deltaP(); 42 | double getLastDeltaP(); 43 | double getNextF(int index, int component); 44 | MyVector3D getForcesVelocity(int component); 45 | bool isFluid(); 46 | void injectNeighbors(BaseCell** neighbors); 47 | int getIndex(); 48 | void setIndex(int index); 49 | int getOpenCLType(); 50 | BaseCell* clone(); 51 | private: 52 | BaseCell **neighbors; 53 | int index; 54 | }; 55 | 56 | #endif // THERMALWALL_H 57 | -------------------------------------------------------------------------------- /model/latticeboltzmann/boundary/fixedboundary.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef FIXEDBOUNDARY_H 20 | #define FIXEDBOUNDARY_H 21 | 22 | #include "boundary.h" 23 | 24 | class FixedBoundary : public Boundary { 25 | public: 26 | FixedBoundary(); 27 | void preUpdate(double epsilon[], BaseCell* neighbors[], Grid *grid, Vector3i position); 28 | void preUpdate2(double epsilon[], BaseCell* neighbors[], Grid *grid, Vector3i position); 29 | void update(); 30 | void postUpdate(Grid *grid, Vector3i position); 31 | void reset(double p0, double p1); 32 | double getF(int index, int); 33 | void setNextF(int index, double value, int component); 34 | void passivate(QXmlStreamWriter &writer); 35 | void activate(QXmlStreamReader &reader, Grid *grid); 36 | void configPressure(double pressure); 37 | void configVelocity(double velocity); 38 | double getVelocity(); 39 | double getPressure(); 40 | void setMultiComponentIndex(int multiComponentIndex); 41 | void setMulticomponent(int multicomponent); 42 | double getP(int index); 43 | MyVector3D getU(int index); 44 | double deltaP(); 45 | double getLastDeltaP(); 46 | double getNextF(int index, int component); 47 | MyVector3D getForcesVelocity(int component); 48 | bool isFluid(); 49 | int getOpenCLType(); 50 | private: 51 | double pressure, velocity; 52 | int multiComponentIndex; 53 | double nextF[9]; 54 | }; 55 | 56 | #endif // FIXEDBOUNDARY_H 57 | -------------------------------------------------------------------------------- /model/latticeboltzmann/multi/rkcell.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef RKCELL_H 20 | #define RKCELL_H 21 | 22 | #include "../../../model/latticeboltzmann/basecell.h" 23 | class GridConfig; 24 | #include 25 | #include "../../../model/math/myvector3d.h" 26 | 27 | class RKCell : public BaseCell { 28 | public: 29 | RKCell(); 30 | ~RKCell(); 31 | void preUpdate(double epsilon[], BaseCell* neighbors[], Grid *grid, Vector3i position); 32 | void preUpdate2(double epsilon[], BaseCell* neighbors[], Grid *grid, Vector3i position); 33 | void update(); 34 | void postUpdate(Grid *grid, Vector3i position); 35 | void reset(double p0, double p1); 36 | double getF(int index, int component); 37 | void setNextF(int index, double value, int component); 38 | void setMulticomponent(int multicomponent); 39 | double getP(int index); 40 | MyVector3D getU(int index); 41 | double deltaP(); 42 | double getLastDeltaP(); 43 | double getNextF(int index, int component); 44 | MyVector3D getForcesVelocity(int component); 45 | bool isFluid(); 46 | int getOpenCLType(); 47 | double getColor(); 48 | void passivate(QXmlStreamWriter &writer); 49 | void activate(QXmlStreamReader &reader, Grid *grid); 50 | void updateFromOpenCL(double *data); 51 | private: 52 | void updatePU(); 53 | double *red, *nextRed, *blue, *nextBlue; 54 | double redP, blueP; 55 | MyVector3D u; 56 | }; 57 | 58 | #endif // RKCELL_H 59 | -------------------------------------------------------------------------------- /model/listener/listenerdata.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "listenerdata.h" 20 | 21 | ListenerData::ListenerData(int width, int height, int length, long iterations, double particles, double deltaP, double deltaDeltaP, double averageP) : 22 | width(width), height(height), length(length), iterations(iterations), particles(particles), deltaP(deltaP), deltaDeltaP(deltaDeltaP), averageP(averageP) { 23 | } 24 | 25 | ListenerData ListenerData::createIterations(long iterations, double particles, double deltaP, double deltaDeltaP, double averageP) { 26 | return ListenerData(-1, -1, -1, iterations, particles, deltaP, deltaDeltaP, averageP); 27 | } 28 | 29 | ListenerData ListenerData::createSize(int width, int height, int length) { 30 | return ListenerData(width, height, length, -1, -1, -1, -1, -1); 31 | } 32 | 33 | long ListenerData::getIterations() const { 34 | return iterations; 35 | } 36 | 37 | double ListenerData::getParticles() const { 38 | return particles; 39 | } 40 | 41 | int ListenerData::getWidth() const { 42 | return width; 43 | } 44 | 45 | int ListenerData::getHeight() const { 46 | return height; 47 | } 48 | 49 | int ListenerData::getLength() const { 50 | return length; 51 | } 52 | 53 | double ListenerData::getDeltaP() const { 54 | return deltaP; 55 | } 56 | 57 | double ListenerData::getDeltaDeltaP() const { 58 | return deltaDeltaP; 59 | } 60 | 61 | double ListenerData::getAverageP() const { 62 | return averageP; 63 | } 64 | -------------------------------------------------------------------------------- /model/latticeboltzmann/boundary/equilibriumboundary.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef EQUILIBRIUMBOUNDARY_H 20 | #define EQUILIBRIUMBOUNDARY_H 21 | 22 | #include "boundary.h" 23 | 24 | class EquilibriumBoundary : public Boundary { 25 | public: 26 | EquilibriumBoundary(); 27 | ~EquilibriumBoundary(); 28 | void preUpdate(double epsilon[], BaseCell* neighbors[], Grid *grid, Vector3i position); 29 | void preUpdate2(double epsilon[], BaseCell* neighbors[], Grid *grid, Vector3i position); 30 | void update(); 31 | void postUpdate(Grid *grid, Vector3i position); 32 | void reset(double p0, double p1); 33 | double getF(int index, int); 34 | void configPressure(double pressure); 35 | void configVelocity(double velocity); 36 | double getVelocity(); 37 | double getPressure(); 38 | void passivate(QXmlStreamWriter &writer); 39 | void activate(QXmlStreamReader &reader, Grid *grid); 40 | void setNextF(int index, double value, int component); 41 | void setMultiComponentIndex(int multiComponentIndex); 42 | void setMulticomponent(int multicomponent); 43 | double getP(int index); 44 | MyVector3D getU(int index); 45 | double deltaP(); 46 | double getLastDeltaP(); 47 | double getNextF(int index, int component); 48 | MyVector3D getForcesVelocity(int component); 49 | bool isFluid(); 50 | int getOpenCLType(); 51 | private: 52 | double pressure, velocity; 53 | int multiComponentIndex; 54 | }; 55 | 56 | #endif // EQUILIBRIUMBOUNDARY_H 57 | -------------------------------------------------------------------------------- /model/latticeboltzmann/nullcell.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "nullcell.h" 20 | #include 21 | #include "../../model/latticeboltzmann/lbgrid.h" 22 | #include "../../model/math/vector3i.h" 23 | #include "../../model/math/myvector3d.h" 24 | #include 25 | 26 | int NullCell::getOpenCLType() { 27 | return 10; 28 | } 29 | 30 | NullCell::NullCell() { 31 | } 32 | 33 | void NullCell::preUpdate(double[], BaseCell*[], Grid*, Vector3i) { 34 | } 35 | 36 | void NullCell::preUpdate2(double[], BaseCell*[], Grid*, Vector3i) { 37 | } 38 | 39 | void NullCell::update() { 40 | } 41 | 42 | void NullCell::postUpdate(Grid*, Vector3i) { 43 | } 44 | 45 | void NullCell::reset(double, double) { 46 | } 47 | 48 | double NullCell::getF(int, int) { 49 | return 0; 50 | } 51 | 52 | void NullCell::setNextF(int, double, int) { 53 | } 54 | 55 | void NullCell::setMulticomponent(int) { 56 | } 57 | 58 | void NullCell::passivate(QXmlStreamWriter &writer) { 59 | writer.writeAttribute("type", "null"); 60 | } 61 | 62 | double NullCell::getP(int) { 63 | return 0; 64 | } 65 | 66 | MyVector3D NullCell::getU(int) { 67 | return MyVector3D(); 68 | } 69 | 70 | double NullCell::deltaP() { 71 | return 0; 72 | } 73 | 74 | double NullCell::getLastDeltaP() { 75 | return 0; 76 | } 77 | 78 | double NullCell::getNextF(int, int) { 79 | return 0; 80 | } 81 | 82 | MyVector3D NullCell::getForcesVelocity(int) { 83 | return MyVector3D(); 84 | } 85 | 86 | bool NullCell::isFluid() { 87 | return false; 88 | } 89 | -------------------------------------------------------------------------------- /model/latticeboltzmann/basecell.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef BASELATTICE_H 20 | #define BASELATTICE_H 21 | 22 | class QXmlStreamReader; 23 | class QXmlStreamWriter; 24 | class Vector3i; 25 | class MyVector3D; 26 | class Force; 27 | class Grid; 28 | #include 29 | 30 | class BaseCell { 31 | public: 32 | virtual ~BaseCell(); 33 | virtual void preUpdate(double epsilon[], BaseCell* neighbors[], Grid *grid, Vector3i position) = 0; 34 | virtual void preUpdate2(double epsilon[], BaseCell* neighbors[], Grid *grid, Vector3i position) = 0; 35 | virtual void update() = 0; 36 | virtual void postUpdate(Grid *grid, Vector3i position) = 0; 37 | virtual void reset(double p0, double p1) = 0; 38 | virtual double getF(int index, int component) = 0; 39 | virtual void setNextF(int index, double value, int component) = 0; 40 | virtual void setMulticomponent(int multicomponent) = 0; 41 | virtual void passivate(QXmlStreamWriter &writer); 42 | virtual void activate(QXmlStreamReader &reader, Grid *grid); 43 | virtual double getP(int index) = 0; 44 | virtual MyVector3D getU(int index) = 0; 45 | virtual double deltaP() = 0; 46 | virtual double getLastDeltaP() = 0; 47 | virtual double getNextF(int index, int component) = 0; 48 | virtual MyVector3D getForcesVelocity(int component) = 0; 49 | virtual bool isFluid() = 0; 50 | virtual int getOpenCLType() = 0; 51 | virtual void updateFromOpenCL(double *data); 52 | virtual BaseCell* clone(); 53 | }; 54 | 55 | #endif // BASELATTICE_H 56 | -------------------------------------------------------------------------------- /model/latticeboltzmann/thermal/passivescalar.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef PASSIVESCALAR_H 20 | #define PASSIVESCALAR_H 21 | 22 | #include "../../../model/latticeboltzmann/basecell.h" 23 | #include 24 | #include "../../../model/math/myvector3d.h" 25 | 26 | class PassiveScalar : public BaseCell { 27 | public: 28 | PassiveScalar(); 29 | ~PassiveScalar(); 30 | void preUpdate(double epsilon[], BaseCell* neighbors[], Grid *grid, Vector3i position); 31 | void preUpdate2(double epsilon[], BaseCell* neighbors[], Grid *grid, Vector3i position); 32 | void update(); 33 | void postUpdate(Grid *grid, Vector3i position); 34 | void reset(double p0, double p1); 35 | double getF(int index, int component); 36 | void setNextF(int index, double value, int component); 37 | void setMulticomponent(int multicomponent); 38 | void passivate(QXmlStreamWriter &writer); 39 | void activate(QXmlStreamReader &reader, Grid *grid); 40 | double getP(int index); 41 | MyVector3D getU(int index); 42 | double deltaP(); 43 | double getLastDeltaP(); 44 | double getNextF(int index, int component); 45 | MyVector3D getForcesVelocity(int component); 46 | bool isFluid(); 47 | int getOpenCLType(); 48 | void updateFromOpenCL(double *data); 49 | BaseCell* clone(); 50 | void config(double p1, MyVector3D v, double p2); 51 | private: 52 | void calc(); 53 | double *f, *g, *nextF, *nextG; 54 | double p[2], p0[2]; 55 | MyVector3D u; 56 | double lastDeltaP; 57 | }; 58 | 59 | #endif // PASSIVESCALAR_H 60 | -------------------------------------------------------------------------------- /view/particles.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef PARTICLES_H 20 | #define PARTICLES_H 21 | 22 | #include 23 | #include 24 | class LBWidget; 25 | 26 | namespace Ui { 27 | class Particles; 28 | } 29 | 30 | class Particles : public QDialog { 31 | Q_OBJECT 32 | public: 33 | explicit Particles(LBWidget *widget, QWidget *parent = 0); 34 | ~Particles(); 35 | void load(); 36 | private: 37 | void controls(bool enabled); 38 | void particlesOrPassiveScalar(); 39 | void updateNextId(); 40 | Ui::Particles *ui; 41 | LBWidget *widget; 42 | QStringListModel *stringListModel; 43 | QStringList stringList; 44 | int nextId; 45 | QColor color; 46 | QColor color2; 47 | public slots: 48 | void on_diffusionEffect_returnPressed(); 49 | void on_velocity_returnPressed(); 50 | void on_deleteAll_clicked(); 51 | void on_resetAll_clicked(); 52 | void on_particlesDelete_clicked(); 53 | void on_reset_clicked(); 54 | void on_update_clicked(); 55 | void on_particles_clicked(QModelIndex index); 56 | void on_color_clicked(); 57 | void on_particlesNew_clicked(); 58 | private slots: 59 | void on_gridSpacing_returnPressed(); 60 | void on_injectionPeriod_returnPressed(); 61 | void on_color2_clicked(); 62 | void on_particlesType_clicked(); 63 | void on_passiveScalarType_clicked(); 64 | void on_injectionTime_returnPressed(); 65 | void on_initialConcentration_returnPressed(); 66 | void on_fixedConcentration_returnPressed(); 67 | }; 68 | 69 | #endif // PARTICLES_H 70 | -------------------------------------------------------------------------------- /model/latticeboltzmann/moving/movingcell.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef MOVINGLATTICE_H 20 | #define MOVINGLATTICE_H 21 | 22 | class Grid; 23 | #include "../../../model/latticeboltzmann/basecell.h" 24 | class Grid; 25 | class MovingParticle; 26 | class SomethingMoving; 27 | 28 | class MovingCell : public BaseCell { 29 | public: 30 | MovingCell(double p0, int charge, Grid *grid); 31 | ~MovingCell(); 32 | void init(); 33 | void preUpdate(double epsilon[], BaseCell* neighbors[], Grid *grid, Vector3i position); 34 | void preUpdate2(double epsilon[], BaseCell* neighbors[], Grid *grid, Vector3i position); 35 | void update(); 36 | void postUpdate(Grid *grid, Vector3i position); 37 | void reset(double p0, double p1); 38 | double getNextF(int index, int component); 39 | double getF(int index, int); 40 | SomethingMoving* getParticle(); 41 | void setParticle(SomethingMoving *particle); 42 | int getCharge(); 43 | void passivate(QXmlStreamWriter &writer); 44 | void activate(QXmlStreamReader &reader, Grid *grid); 45 | void setNextF(int index, double value, int component); 46 | void setMulticomponent(int multicomponent); 47 | double getP(int index); 48 | MyVector3D getU(int index); 49 | double deltaP(); 50 | double getLastDeltaP(); 51 | MyVector3D getForcesVelocity(int component); 52 | bool isFluid(); 53 | int getOpenCLType(); 54 | BaseCell* clone(); 55 | private: 56 | SomethingMoving* particle; 57 | Grid *grid; 58 | int charge; 59 | double *nextF; 60 | double p0; 61 | }; 62 | 63 | #endif // MOVINGLATTICE_H 64 | -------------------------------------------------------------------------------- /view/util/improvedlineedit.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "improvedlineedit.h" 20 | #include 21 | #include "singleton.h" 22 | #include 23 | 24 | ImprovedLineEdit::ImprovedLineEdit(QWidget *parent) : QLineEdit(parent) { 25 | allowDecimal = false; 26 | allowNegative = false; 27 | connect(this, SIGNAL(textEdited(QString)), this, SLOT(textEdited())); 28 | connect(this, SIGNAL(returnPressed()), this, SLOT(returnPressed())); 29 | } 30 | 31 | void ImprovedLineEdit::keyPressEvent(QKeyEvent *event) { 32 | QLineEdit::keyPressEvent(event); 33 | if (event->key() == Qt::Key_Up || event->key() == Qt::Key_Down) { 34 | this->setText(QString::number(this->text().toDouble() + (event->key() == Qt::Key_Up ? 1 : -1))); 35 | textEdited(); 36 | } 37 | } 38 | 39 | void ImprovedLineEdit::textEdited() { 40 | QPalette palette = this->palette(); 41 | palette.setColor(QPalette::Text, Qt::red); 42 | this->setPalette(palette); 43 | } 44 | 45 | void ImprovedLineEdit::returnPressed() { 46 | this->setText(allowDecimal ? QString::number(this->text().toDouble()) : QString::number(this->text().toInt())); 47 | if (!allowNegative && this->text().at(0) == '-') { 48 | this->setText("0"); 49 | } 50 | QPalette palette = this->palette(); 51 | palette.setColor(QPalette::Text, Qt::black); 52 | this->setPalette(palette); 53 | } 54 | 55 | void ImprovedLineEdit::setAllowDecimal(bool allowDecimal) { 56 | this->allowDecimal = allowDecimal; 57 | } 58 | 59 | void ImprovedLineEdit::setAllowNegative(bool allowNegative) { 60 | this->allowNegative = allowNegative; 61 | } 62 | -------------------------------------------------------------------------------- /model/inputoutput/matlabreporter.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "matlabreporter.h" 20 | #include "../../model/latticeboltzmann/gridconfig.h" 21 | #include "../../model/latticeboltzmann/lbgrid.h" 22 | #include "../../model/latticeboltzmann/basecell.h" 23 | #include "../../model/math/myvector3d.h" 24 | #include 25 | #include 26 | 27 | using std::fstream; 28 | 29 | MATLABReporter::MATLABReporter() { 30 | } 31 | 32 | void MATLABReporter::streamlines(Grid *grid, QString &fileName, QString start) { 33 | fstream fs; 34 | fs.open(fileName.toStdString().c_str(), fstream::out); 35 | fs << "[sx,sy] = " << start.toStdString() << ";\n"; 36 | fs << "u = [\n"; 37 | for (int i = 0; i < grid->getConfig()->getWidth(); i++) { 38 | fs << grid->getGrid(0, i, 0)->getU(0).getX() << " "; 39 | } 40 | for (int j = 1; j < grid->getConfig()->getHeight(); j++) { 41 | fs << ";\n"; 42 | for (int i = 0; i < grid->getConfig()->getWidth(); i++) { 43 | fs << grid->getGrid(j, i, 0)->getU(0).getX() << " "; 44 | } 45 | } 46 | fs << "];\n"; 47 | fs << "v = [\n"; 48 | for (int i = 0; i < grid->getConfig()->getWidth(); i++) { 49 | fs << grid->getGrid(0, i, 0)->getU(0).getY() << " "; 50 | } 51 | for (int j = 1; j < grid->getConfig()->getHeight(); j++) { 52 | fs << ";\n"; 53 | for (int i = 0; i < grid->getConfig()->getWidth(); i++) { 54 | fs << grid->getGrid(j, i, 0)->getU(0).getY() << " "; 55 | } 56 | } 57 | fs << "];\n"; 58 | fs << "h = streamline(u,v,sx,sy);\n"; 59 | fs << "view(2);\n"; 60 | fs.close(); 61 | } 62 | -------------------------------------------------------------------------------- /model/latticeboltzmann/moving/particlemanager.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef PARTICLEMANAGER_H 20 | #define PARTICLEMANAGER_H 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | class MovingCell; 27 | class MovingParticle; 28 | class Grid; 29 | 30 | class ParticleManager { 31 | public: 32 | ParticleManager(Grid *grid); 33 | ~ParticleManager(); 34 | void preUpdate(); 35 | void update(); 36 | void transformSmallParticles(); 37 | void onLatticeAdded(int i, int j, int k, MovingCell *lattice); 38 | void onLatticeRemoved(int i, int j, int k, MovingCell *lattice); 39 | std::list* getParticles(); 40 | double getElectrostaticCoefficient(); 41 | void setElectrostaticCoefficient(double electrostaticCoefficient); 42 | double getGravityCoefficient(); 43 | void setGravityCoefficient(double gravityCoefficient); 44 | void reset(); 45 | void setFrozen(bool frozen); 46 | double getTemp(); 47 | void setNormalizeVelocities(bool normalizeVelocities); 48 | bool getNormalizeVelocities(); 49 | void passivate(QXmlStreamWriter &writer); 50 | void activate(QXmlStreamReader &reader); 51 | int getParticlesMap(MovingParticle *particle); 52 | MovingParticle* getParticlesMap(int position); 53 | private: 54 | Grid *grid; 55 | std::list *particles; 56 | std::list *smallParticles; 57 | double electrostaticCoefficient; 58 | double gravityCoefficient; 59 | double temp; 60 | bool removeOrphanParticles; 61 | bool normalizeVelocities; 62 | }; 63 | 64 | #endif // PARTICLEMANAGER_H 65 | -------------------------------------------------------------------------------- /model/latticeboltzmann/boundary/wallcell.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef WALLLATTICE_H 20 | #define WALLLATTICE_H 21 | 22 | #include "../basecell.h" 23 | 24 | class WallCell : public BaseCell { 25 | public: 26 | WallCell(); 27 | ~WallCell(); 28 | virtual void preUpdate(double epsilon[], BaseCell* neighbors[], Grid *grid, Vector3i position); 29 | virtual void preUpdate2(double epsilon[], BaseCell* neighbors[], Grid *grid, Vector3i position); 30 | virtual void update(); 31 | virtual void postUpdate(Grid *grid, Vector3i position); 32 | virtual void reset(double p0, double p1); 33 | virtual double getF(int index); 34 | virtual void passivate(QXmlStreamWriter &writer); 35 | virtual void setMulticomponent(int multicomponent); 36 | virtual double getF(int index, int component); 37 | virtual double getF0(int index, double epsilon, BaseCell* neighbors[], int component); 38 | virtual void setNextF(int index, double value, int component); 39 | virtual void injectNeighbors(BaseCell** neighbors); 40 | virtual double getP(int index); 41 | virtual MyVector3D getU(int index); 42 | virtual double deltaP(); 43 | virtual double getLastDeltaP(); 44 | virtual double getNextF(int index, int component); 45 | virtual MyVector3D getForcesVelocity(int component); 46 | virtual bool isFluid(); 47 | virtual int getOpenCLType(); 48 | BaseCell** getNeighbors(); 49 | BaseCell* clone(); 50 | protected: 51 | /*void updateF(int model, int multicomponent); 52 | int model; 53 | double f[54], nextF[54]; 54 | double p0; 55 | int multicomponent;*/ 56 | BaseCell** neighbors; 57 | }; 58 | 59 | #endif // WALLLATTICE_H 60 | -------------------------------------------------------------------------------- /model/latticeboltzmann/extra/velocityfield.h: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef VELOCITYFIELD_H 20 | #define VELOCITYFIELD_H 21 | 22 | class Grid; 23 | class Particle; 24 | class StartingParticle; 25 | #include 26 | class QXmlStreamWriter; 27 | class QXmlStreamReader; 28 | class Grid; 29 | class InitialParticle; 30 | 31 | class VelocityField { 32 | public: 33 | VelocityField(Grid *grid); 34 | ~VelocityField(); 35 | void addStartingPathLine(StartingParticle* pathLine); 36 | void remove(int id); 37 | void removeAll(); 38 | void reset(int id); 39 | void resetAll(); 40 | void setAddNew(bool addNew); 41 | StartingParticle* getStartingPathLine(int id); 42 | std::list* getStartingPathLines(); 43 | std::list* getInitialParticles(); 44 | void processPathLines(); 45 | int getAcceleration(); 46 | void setAcceleration(int acceleration); 47 | double getDiffusionEffect(); 48 | void setDiffusionEffect(double diffusionEffect); 49 | int getGridSpacing(); 50 | void setGridSpacing(int gridSpacing); 51 | int getInjectionPeriod(); 52 | void setInjectionPeriod(int injectionPeriod); 53 | int getInjectionTime(); 54 | void setInjectionTime(int injectionTime); 55 | void passivate(QXmlStreamWriter &writer); 56 | void activate(QXmlStreamReader &reader); 57 | private: 58 | void rebuildInitial(); 59 | Grid *grid; 60 | std::list *startingPathLines; 61 | std::list *initialParticles; 62 | int acceleration; 63 | double diffusionEffect; 64 | int gridSpacing, injectionPeriod, injectionTime; 65 | }; 66 | 67 | #endif // VELOCITYFIELD_H 68 | -------------------------------------------------------------------------------- /model/latticeboltzmann/boundary/dragwallcell.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | LBSim: a fluid dynamics simulator using the lattice Boltzmann method 3 | Copyright (C) 2013 Fabio Sussumu Komori - NDS/GNMD/LME/PSI/EP/USP 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "dragwallcell.h" 20 | #include "../../../model/latticeboltzmann/lbutil.h" 21 | #include "../../../model/math/vector3i.h" 22 | #include 23 | #include 24 | #include "../../../model/latticeboltzmann/lbgrid.h" 25 | #include "../../../model/latticeboltzmann/gridconfig.h" 26 | #include "../../../model/latticeboltzmann/basecell.h" 27 | 28 | DragWallCell::DragWallCell() { 29 | index = -1; 30 | } 31 | 32 | void DragWallCell::activate(QXmlStreamReader &reader, Grid *) { 33 | index = reader.attributes().value("index").toString().toInt(); 34 | } 35 | 36 | void DragWallCell::passivate(QXmlStreamWriter &writer) { 37 | writer.writeAttribute("type", "dragWall"); 38 | writer.writeAttribute("index", QString::number(index)); 39 | } 40 | 41 | void DragWallCell::setNextF(int index, double value, int component) { 42 | WallCell::setNextF(index, value, component); 43 | } 44 | 45 | void DragWallCell::update() { 46 | } 47 | 48 | MyVector3D DragWallCell::getDragForce(Grid *grid, Vector3i position) { 49 | MyVector3D drag; 50 | BaseCell **neighbors = grid->getNeighbors(position.getX(), position.getY(), position.getZ()); 51 | for (int i = 0; i < grid->getConfig()->getModel(); i++) { 52 | if (neighbors[i] != 0) { 53 | drag = drag + (LBUtil::C[grid->getConfig()->getModel()][i] ^ (2 * neighbors[i]->getF(LBUtil::OPPOSITE[grid->getConfig()->getModel()][i], 0))); 54 | } 55 | } 56 | return drag; 57 | } 58 | 59 | int DragWallCell::getIndex() { 60 | return index; 61 | } 62 | 63 | void DragWallCell::setIndex(int index) { 64 | this->index = index; 65 | } 66 | --------------------------------------------------------------------------------