hemocell
Loading...
Searching...
No Matches
meshGeneratingFunctions.h
Go to the documentation of this file.
1/*
2This file is part of the HemoCell library
3
4HemoCell is developed and maintained by the Computational Science Lab
5in the University of Amsterdam. Any questions or remarks regarding this library
6can be sent to: info@hemocell.eu
7
8When using the HemoCell library in scientific work please cite the
9corresponding paper: https://doi.org/10.3389/fphys.2017.00563
10
11The HemoCell library is free software: you can redistribute it and/or
12modify it under the terms of the GNU Affero General Public License as
13published by the Free Software Foundation, either version 3 of the
14License, or (at your option) any later version.
15
16The library is distributed in the hope that it will be useful,
17but WITHOUT ANY WARRANTY; without even the implied warranty of
18MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19GNU Affero General Public License for more details.
20
21You should have received a copy of the GNU Affero General Public License
22along with this program. If not, see <http://www.gnu.org/licenses/>.
23*/
24#ifndef MESH_GENERATING_FUNCTIONS_H
25#define MESH_GENERATING_FUNCTIONS_H
26
27#include "constant_defaults.h"
28#include "config.h"
29
30#include "offLattice/triangleSet.hh"
31#include "offLattice/triangleToDef.hh"
32#include "offLattice/triangleSetGenerator.hh"
33#include "offLattice/triangularSurfaceMesh.hh"
34#include "offLattice/triangleBoundary3D.hh"
35
36namespace plb {
37
38template <typename T>
39TriangleSet<T> constructCell(plb::Array<T, 3> const & center, T radius, std::string cellFilename,
40 plb::Array<T, 3> const & eulerAngles);
41
42
43template <typename T>
44TriangleSet<T> constructSphereIcosahedron(plb::Array<T, 3> const & center, T radius, plint minNumOfTriangles);
45
46
47template <typename T>
48plb::Array<T, 3> mapMeshAsRBC(const plb::Array<T, 3> point, const plb::Array<T, 3> center, T R);
49
50
51template <typename T>
52plb::Array<T, 3> spherePointToRBCPoint(const plb::Array<T, 3> point, T R = 1.0);
53
54
55template <typename T>
56TriangleSet<T> constructRBC(plb::Array<T, 3> const & center, T radius, plint minNumOfTriangles,
57 plb::Array<T, 3> const & eulerAngles);
58
59
60// initialSphereShape: [0] Octahedron (PLB Sphere ) [1] Icosahedron
61template <typename T>
62TriangleSet<T> constructRBCFromSphere(plb::Array<T, 3> const & center, T radius, plint minNumOfTriangles,
63 plb::Array<T, 3> const & eulerAngles, pluint initialSphereShape = 0);
64
65template <typename T>
66TriangleSet<T> constructEllipsoidFromSphere(plb::Array<T, 3> const & center, T radius, T aspectRatio,
67 plint minNumOfTriangles, plb::Array<T, 3> const & eulerAngles,
68 pluint initialSphereShape);
69
70
71template <typename T>
72TriangleBoundary3D<T> constructMeshElement(plint shape, T radius, plint cellNumTriangles, T dx, std::string cellPath,
73 plb::Array<T, 3> const & eulerAngles, T aspectRatio = 0.3) {
74 plb::Array<T, 3> center({0.0, 0.0, 0.0});
75 std::vector<TriangleSet<T>> allTriangles;
76 TriangleSet<T> wholeTriangleSet;
77 if (shape == 0) {
78 wholeTriangleSet.append(constructSphereIcosahedron<T>(center, radius, cellNumTriangles));
79 } else if (shape == 1) {
80 wholeTriangleSet.append(constructRBCFromSphere<T>(center, radius, cellNumTriangles, eulerAngles, 1));
81 } else if (shape == 2) {
82 wholeTriangleSet.append(constructCell<T>(center, radius, cellPath, eulerAngles));
83 } else if (shape == 3) {
84 wholeTriangleSet.append(constructRBC<T>(center, radius, cellNumTriangles, eulerAngles));
85 } else if (shape == 4) {
86 wholeTriangleSet.append(constructRBCFromSphere<T>(center, radius, cellNumTriangles, eulerAngles, 0));
87 } else if (shape == 5) {
88 wholeTriangleSet.append(constructSphere<T>(center, radius, cellNumTriangles));
89 } else if (shape == 6) {
90 wholeTriangleSet.append(
91 constructEllipsoidFromSphere<T>(center, radius, aspectRatio, cellNumTriangles, eulerAngles, 0));
92 }
93 /* Unknown code, was there from the beginning, let it be */
94 DEFscaledMesh<T> defMesh(wholeTriangleSet);
95 defMesh.setDx(dx);
96 TriangleBoundary3D<T> Cells(defMesh);
97 Cells.getMesh().inflate();
98 return Cells;
99}
100
101
102} // namespace plb
103
104plb::TriangularSurfaceMesh<T> * constructStringMeshFromConfig(hemo::Config & materialCfg);
105
107
108#endif // MESH_GENERATING_FUNCTIONS_H
Definition config.h:91
double T
Definition constant_defaults.h:137
long int plint
Definition constant_defaults.h:149
long unsigned int pluint
Definition constant_defaults.h:152
plb::TriangularSurfaceMesh< T > * constructStringMeshFromConfig(hemo::Config &materialCfg)
Definition meshGeneratingFunctions.cpp:28
plb::Array< T, 3 > mapMeshAsRBC(const plb::Array< T, 3 > point, const plb::Array< T, 3 > center, T R)
Definition meshGeneratingFunctions.hh:220
TriangleSet< T > constructCell(plb::Array< T, 3 > const &center, T radius, std::string cellFilename, plb::Array< T, 3 > const &eulerAngles)
Definition meshGeneratingFunctions.hh:295
plb::Array< T, 3 > spherePointToRBCPoint(const plb::Array< T, 3 > point, T R=1.0)
Definition meshGeneratingFunctions.hh:192
TriangleBoundary3D< T > constructMeshElement(plint shape, T radius, plint cellNumTriangles, T dx, std::string cellPath, plb::Array< T, 3 > const &eulerAngles, T aspectRatio=0.3)
Definition meshGeneratingFunctions.h:72
TriangleSet< T > constructRBCFromSphere(plb::Array< T, 3 > const &center, T radius, plint minNumOfTriangles, plb::Array< T, 3 > const &eulerAngles, pluint initialSphereShape=0)
Definition meshGeneratingFunctions.hh:247
TriangleSet< T > constructRBC(plb::Array< T, 3 > const &center, T radius, plint minNumOfTriangles, plb::Array< T, 3 > const &eulerAngles)
Definition meshGeneratingFunctions.hh:240
TriangleSet< T > constructEllipsoidFromSphere(plb::Array< T, 3 > const &center, T radius, T aspectRatio, plint minNumOfTriangles, plb::Array< T, 3 > const &eulerAngles, pluint initialSphereShape)
Definition meshGeneratingFunctions.hh:271
TriangleSet< T > constructSphereIcosahedron(plb::Array< T, 3 > const &center, T radius, plint minNumOfTriangles)
Definition meshGeneratingFunctions.hh:32