2009-01-13 04:40:13 +05:00
|
|
|
#ifndef FILE_BOUNDARYLAYER
|
|
|
|
#define FILE_BOUNDARYLAYER
|
|
|
|
|
|
|
|
|
|
|
|
///
|
2015-10-19 13:08:30 +05:00
|
|
|
DLL_HEADER extern void InsertVirtualBoundaryLayer (Mesh & mesh);
|
2009-01-13 04:40:13 +05:00
|
|
|
|
2009-06-19 11:43:23 +06:00
|
|
|
/// Create a typical prismatic boundary layer on the given
|
|
|
|
/// surfaces
|
2014-12-18 19:00:58 +05:00
|
|
|
|
|
|
|
class BoundaryLayerParameters
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
// parameters by Philippose ..
|
2020-04-19 23:00:06 +05:00
|
|
|
Array<int> surfid;
|
|
|
|
Array<double> heights;
|
2022-11-10 18:35:58 +05:00
|
|
|
map<string, string> new_mat;
|
2020-04-23 18:44:32 +05:00
|
|
|
BitArray domains;
|
2020-04-19 23:00:06 +05:00
|
|
|
bool outside = false; // set the boundary layer on the outside
|
|
|
|
bool grow_edges = false;
|
2022-06-07 17:51:41 +05:00
|
|
|
bool limit_growth_vectors = true;
|
2023-03-30 20:19:34 +05:00
|
|
|
bool sides_keep_surfaceindex = false;
|
2020-11-03 16:28:13 +05:00
|
|
|
Array<size_t> project_boundaries;
|
2014-12-18 19:00:58 +05:00
|
|
|
};
|
|
|
|
|
2020-04-19 23:00:06 +05:00
|
|
|
DLL_HEADER void GenerateBoundaryLayer (Mesh & mesh,
|
|
|
|
const BoundaryLayerParameters & blp);
|
2009-06-19 11:43:23 +06:00
|
|
|
|
2021-03-30 19:54:39 +05:00
|
|
|
DLL_HEADER int /* new_domain_number */ GenerateBoundaryLayer2 (Mesh & mesh, int domain, const Array<double> & thicknesses, bool should_make_new_domain=true, const Array<int> & boundaries=Array<int>{});
|
2009-01-13 04:40:13 +05:00
|
|
|
|
2022-03-07 19:58:09 +05:00
|
|
|
class BoundaryLayerTool
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
BoundaryLayerTool(Mesh & mesh_, const BoundaryLayerParameters & params_);
|
|
|
|
void Perform();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
Mesh & mesh;
|
|
|
|
MeshTopology & topo;
|
|
|
|
BoundaryLayerParameters params;
|
|
|
|
Array<Vec<3>, PointIndex> growthvectors;
|
|
|
|
Table<SurfaceElementIndex, PointIndex> p2sel;
|
|
|
|
|
|
|
|
BitArray domains, is_edge_moved, is_boundary_projected, is_boundary_moved;
|
|
|
|
Array<SegmentIndex> moved_segs;
|
2022-11-10 18:35:58 +05:00
|
|
|
int max_edge_nr, nfd_old, ndom_old;
|
|
|
|
Array<int> new_mat_nrs;
|
2023-03-30 20:19:34 +05:00
|
|
|
BitArray moved_surfaces;
|
2022-03-07 19:58:09 +05:00
|
|
|
int np, nseg, nse, ne;
|
2022-03-07 19:58:09 +05:00
|
|
|
double height;
|
2022-03-07 19:58:09 +05:00
|
|
|
|
|
|
|
bool have_single_segments;
|
|
|
|
Array<Segment> segments, new_segments;
|
|
|
|
|
|
|
|
Array<double> surfacefacs;
|
|
|
|
Array<int> si_map;
|
2022-03-07 19:58:09 +05:00
|
|
|
Array<double, PointIndex> limits;
|
2022-03-07 19:58:09 +05:00
|
|
|
|
|
|
|
// major steps called in Perform()
|
|
|
|
void CreateNewFaceDescriptors();
|
2023-03-30 20:19:34 +05:00
|
|
|
void CreateFaceDescriptorsSides();
|
2022-03-07 19:58:09 +05:00
|
|
|
void CalculateGrowthVectors();
|
|
|
|
Array<Array<pair<SegmentIndex, int>>, SegmentIndex> BuildSegMap();
|
|
|
|
|
|
|
|
BitArray ProjectGrowthVectorsOnSurface();
|
2022-03-07 19:58:09 +05:00
|
|
|
void InterpolateSurfaceGrowthVectors();
|
2022-03-07 19:58:09 +05:00
|
|
|
void InterpolateGrowthVectors();
|
2022-03-07 19:58:09 +05:00
|
|
|
void LimitGrowthVectorLengths();
|
2022-03-07 19:58:09 +05:00
|
|
|
|
|
|
|
void InsertNewElements(FlatArray<Array<pair<SegmentIndex, int>>, SegmentIndex> segmap, const BitArray & in_surface_direction);
|
|
|
|
void SetDomInOut();
|
2023-03-31 02:21:58 +05:00
|
|
|
void SetDomInOutSides();
|
2022-03-07 19:58:09 +05:00
|
|
|
void AddSegments();
|
2022-03-07 19:58:09 +05:00
|
|
|
void FixVolumeElements();
|
2022-03-07 19:58:09 +05:00
|
|
|
|
|
|
|
// utility functions
|
2022-03-07 19:58:09 +05:00
|
|
|
array<Point<3>, 2> GetMappedSeg( PointIndex pi );
|
|
|
|
ArrayMem<Point<3>, 4> GetFace( SurfaceElementIndex sei );
|
|
|
|
ArrayMem<Point<3>, 4> GetMappedFace( SurfaceElementIndex sei );
|
|
|
|
ArrayMem<Point<3>, 4> GetMappedFace( SurfaceElementIndex sei, int face );
|
2022-03-07 19:58:09 +05:00
|
|
|
|
|
|
|
Vec<3> getNormal(const Element2d & el)
|
|
|
|
{
|
|
|
|
auto v0 = mesh[el[0]];
|
|
|
|
return Cross(mesh[el[1]]-v0, mesh[el[2]]-v0).Normalize();
|
|
|
|
}
|
|
|
|
|
2022-03-07 19:58:09 +05:00
|
|
|
Vec<3> getEdgeTangent(PointIndex pi, int edgenr);
|
2022-03-07 19:58:09 +05:00
|
|
|
};
|
|
|
|
|
2009-01-13 04:40:13 +05:00
|
|
|
#endif
|