2023-09-04 16:43:47 +05:00
|
|
|
#ifndef NETGEN_BOUNDARYLAYER_HPP
|
|
|
|
#define NETGEN_BOUNDARYLAYER_HPP
|
2009-01-13 04:40:13 +05:00
|
|
|
|
2023-11-29 13:19:27 +05:00
|
|
|
#include <core/array.hpp>
|
2024-04-05 20:09:34 +05:00
|
|
|
#include <mystdlib.h>
|
|
|
|
#include <meshing.hpp>
|
2023-11-29 13:19:27 +05:00
|
|
|
|
2023-09-04 16:43:47 +05:00
|
|
|
namespace netgen
|
|
|
|
{
|
2009-01-13 04:40:13 +05:00
|
|
|
|
|
|
|
///
|
2024-10-08 19:20:53 +05:00
|
|
|
DLL_HEADER extern void InsertVirtualBoundaryLayer (Mesh& mesh);
|
2009-01-13 04:40:13 +05:00
|
|
|
|
2024-10-08 19:20:53 +05:00
|
|
|
/// Create a typical prismatic boundary layer on the given
|
2009-06-19 11:43:23 +06:00
|
|
|
/// surfaces
|
2014-12-18 19:00:58 +05:00
|
|
|
|
2024-10-08 19:20:53 +05:00
|
|
|
struct SpecialBoundaryPoint
|
|
|
|
{
|
|
|
|
struct GrowthGroup
|
|
|
|
{
|
2023-11-29 13:19:27 +05:00
|
|
|
Array<int> faces;
|
|
|
|
Vec<3> growth_vector;
|
|
|
|
Array<PointIndex> new_points;
|
|
|
|
|
|
|
|
GrowthGroup(FlatArray<int> faces_, FlatArray<Vec<3>> normals);
|
2024-10-08 19:20:53 +05:00
|
|
|
GrowthGroup(const GrowthGroup&) = default;
|
2023-11-29 13:19:27 +05:00
|
|
|
GrowthGroup() = default;
|
|
|
|
};
|
|
|
|
// std::map<int, Vec<3>> normals;
|
|
|
|
Array<GrowthGroup> growth_groups;
|
2024-09-04 18:49:02 +05:00
|
|
|
Vec<3> separating_direction;
|
2023-11-29 13:19:27 +05:00
|
|
|
|
2024-10-08 19:20:53 +05:00
|
|
|
SpecialBoundaryPoint(const std::map<int, Vec<3>>& normals);
|
2023-11-29 13:19:27 +05:00
|
|
|
SpecialBoundaryPoint() = default;
|
|
|
|
};
|
|
|
|
|
2024-10-08 19:20:53 +05:00
|
|
|
DLL_HEADER void GenerateBoundaryLayer (Mesh& mesh,
|
|
|
|
const BoundaryLayerParameters& blp);
|
2009-06-19 11:43:23 +06:00
|
|
|
|
2024-10-08 19:20:53 +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
|
|
|
|
{
|
2024-10-08 19:20:53 +05:00
|
|
|
public:
|
|
|
|
BoundaryLayerTool(Mesh& mesh_, const BoundaryLayerParameters& params_);
|
|
|
|
void ProcessParameters ();
|
|
|
|
void Perform ();
|
|
|
|
|
|
|
|
Mesh& mesh;
|
|
|
|
MeshTopology& topo;
|
|
|
|
BoundaryLayerParameters params;
|
|
|
|
Array<Vec<3>, PointIndex> growthvectors;
|
|
|
|
std::map<PointIndex, Vec<3>> non_bl_growth_vectors;
|
|
|
|
Table<SurfaceElementIndex, PointIndex> p2sel;
|
|
|
|
|
|
|
|
BitArray domains, is_edge_moved, is_boundary_projected, is_boundary_moved;
|
|
|
|
Array<SegmentIndex> moved_segs;
|
|
|
|
int max_edge_nr, nfd_old, ndom_old;
|
|
|
|
Array<int> new_mat_nrs;
|
|
|
|
BitArray moved_surfaces;
|
|
|
|
int np, nseg, nse, ne;
|
|
|
|
double total_height;
|
|
|
|
|
|
|
|
// These parameters are derived from given BoundaryLayerParameters and the Mesh
|
|
|
|
Array<double> par_heights;
|
|
|
|
Array<int> par_surfid;
|
|
|
|
bool insert_only_volume_elements;
|
|
|
|
map<string, string> par_new_mat;
|
|
|
|
Array<size_t> par_project_boundaries;
|
|
|
|
|
|
|
|
bool have_single_segments;
|
2024-10-25 18:04:34 +05:00
|
|
|
Array<Segment> old_segments, segments, new_segments, new_segments_on_moved_bnd;
|
2024-10-08 19:20:53 +05:00
|
|
|
Array<Element2d, SurfaceElementIndex> new_sels, new_sels_on_moved_bnd;
|
|
|
|
Array<Array<PointIndex>, PointIndex> mapto;
|
|
|
|
Array<PointIndex, PointIndex> mapfrom;
|
|
|
|
|
|
|
|
Array<double> surfacefacs;
|
|
|
|
Array<int> si_map;
|
|
|
|
|
|
|
|
std::map<PointIndex, SpecialBoundaryPoint> special_boundary_points;
|
|
|
|
std::map<PointIndex, std::tuple<Vec<3>*, double>> growth_vector_map;
|
|
|
|
|
|
|
|
// major steps called in Perform()
|
|
|
|
void CreateNewFaceDescriptors ();
|
|
|
|
void CreateFaceDescriptorsSides ();
|
|
|
|
void CalculateGrowthVectors ();
|
|
|
|
Array<Array<pair<SegmentIndex, int>>, SegmentIndex> BuildSegMap ();
|
|
|
|
|
|
|
|
BitArray ProjectGrowthVectorsOnSurface ();
|
|
|
|
void InterpolateSurfaceGrowthVectors ();
|
|
|
|
void InterpolateGrowthVectors ();
|
|
|
|
void LimitGrowthVectorLengths ();
|
|
|
|
void FixSurfaceElements ();
|
|
|
|
|
|
|
|
void InsertNewElements (FlatArray<Array<pair<SegmentIndex, int>>, SegmentIndex> segmap, const BitArray& in_surface_direction);
|
|
|
|
void SetDomInOut ();
|
|
|
|
void SetDomInOutSides ();
|
|
|
|
void AddSegments ();
|
|
|
|
void AddSurfaceElements ();
|
|
|
|
|
|
|
|
Vec<3> getNormal (const Element2d& el)
|
|
|
|
{
|
|
|
|
auto v0 = mesh[el[0]];
|
|
|
|
return Cross(mesh[el[1]] - v0, mesh[el[2]] - v0).Normalize();
|
|
|
|
}
|
|
|
|
|
|
|
|
Vec<3> getEdgeTangent (PointIndex pi, int edgenr, FlatArray<Segment*> segs);
|
2022-03-07 19:58:09 +05:00
|
|
|
};
|
|
|
|
|
2023-09-04 16:43:47 +05:00
|
|
|
} // namespace netgen
|
|
|
|
#endif // NETGEN_BOUNDARYLAYER_HPP
|