code formatting in blayer files

This commit is contained in:
Matthias Hochsteger 2025-04-28 15:31:30 +02:00
parent f42d0c0be4
commit 494b0ae37c
4 changed files with 39 additions and 40 deletions

View File

@ -14,7 +14,7 @@ namespace netgen
struct SpecialPointException : public Exception struct SpecialPointException : public Exception
{ {
SpecialPointException() SpecialPointException ()
: Exception("") {} : Exception("") {}
}; };
@ -101,14 +101,14 @@ Vec<3> CalcGrowthVector (FlatArray<Vec<3>> ns)
return gw; return gw;
} }
SpecialBoundaryPoint ::GrowthGroup ::GrowthGroup(FlatArray<int> faces_, SpecialBoundaryPoint ::GrowthGroup ::GrowthGroup (FlatArray<int> faces_,
FlatArray<Vec<3>> normals) FlatArray<Vec<3>> normals)
{ {
faces = faces_; faces = faces_;
growth_vector = CalcGrowthVector(normals); growth_vector = CalcGrowthVector(normals);
} }
SpecialBoundaryPoint ::SpecialBoundaryPoint( SpecialBoundaryPoint ::SpecialBoundaryPoint (
const std::map<int, Vec<3>>& normals) const std::map<int, Vec<3>>& normals)
{ {
// find opposing face normals // find opposing face normals
@ -146,7 +146,7 @@ SpecialBoundaryPoint ::SpecialBoundaryPoint(
growth_groups.Append(GrowthGroup(g2_faces, normals2)); growth_groups.Append(GrowthGroup(g2_faces, normals2));
} }
Vec<3> BoundaryLayerTool ::getEdgeTangent(PointIndex pi, int edgenr, FlatArray<Segment*> segs) Vec<3> BoundaryLayerTool ::getEdgeTangent (PointIndex pi, int edgenr, FlatArray<Segment*> segs)
{ {
Vec<3> tangent = 0.0; Vec<3> tangent = 0.0;
ArrayMem<PointIndex, 2> pts; ArrayMem<PointIndex, 2> pts;
@ -171,7 +171,7 @@ Vec<3> BoundaryLayerTool ::getEdgeTangent(PointIndex pi, int edgenr, FlatArray<S
return tangent.Normalize(); return tangent.Normalize();
} }
void BoundaryLayerTool ::LimitGrowthVectorLengths() void BoundaryLayerTool ::LimitGrowthVectorLengths ()
{ {
static Timer tall("BoundaryLayerTool::LimitGrowthVectorLengths"); static Timer tall("BoundaryLayerTool::LimitGrowthVectorLengths");
RegionTimer rtall(tall); RegionTimer rtall(tall);
@ -220,7 +220,7 @@ bool HaveSingleSegments (const Mesh& mesh)
// duplicates segments (and sets seg.si accordingly) to have a unified data // duplicates segments (and sets seg.si accordingly) to have a unified data
// structure for all geometry types // structure for all geometry types
void BuildSegments (Mesh& mesh, bool have_single_segments, Array<Segment> & segments, Array<Segment> & free_segments) void BuildSegments (Mesh& mesh, bool have_single_segments, Array<Segment>& segments, Array<Segment>& free_segments)
{ {
// auto& topo = mesh.GetTopology(); // auto& topo = mesh.GetTopology();
@ -234,11 +234,11 @@ void BuildSegments (Mesh& mesh, bool have_single_segments, Array<Segment> & segm
free_segments.Append(seg); free_segments.Append(seg);
continue; continue;
} }
if(!have_single_segments) if (!have_single_segments)
{ {
segments.Append(seg); segments.Append(seg);
continue; continue;
} }
mesh.GetTopology().GetSegmentSurfaceElements(segi + 1, surf_els); mesh.GetTopology().GetSegmentSurfaceElements(segi + 1, surf_els);
for (auto seli : surf_els) for (auto seli : surf_els)
{ {
@ -284,8 +284,8 @@ void MergeAndAddSegments (Mesh& mesh, FlatArray<Segment> segments, FlatArray<Seg
addSegment(seg); addSegment(seg);
} }
BoundaryLayerTool::BoundaryLayerTool(Mesh& mesh_, BoundaryLayerTool::BoundaryLayerTool (Mesh& mesh_,
const BoundaryLayerParameters& params_) const BoundaryLayerParameters& params_)
: mesh(mesh_), topo(mesh_.GetTopology()), params(params_) : mesh(mesh_), topo(mesh_.GetTopology()), params(params_)
{ {
static Timer timer("BoundaryLayerTool::ctor"); static Timer timer("BoundaryLayerTool::ctor");
@ -318,7 +318,7 @@ BoundaryLayerTool::BoundaryLayerTool(Mesh& mesh_,
si_map[i] = i; si_map[i] = i;
} }
void BoundaryLayerTool ::CreateNewFaceDescriptors() void BoundaryLayerTool ::CreateNewFaceDescriptors ()
{ {
surfacefacs.SetSize(nfd_old + 1); surfacefacs.SetSize(nfd_old + 1);
surfacefacs = 0.0; surfacefacs = 0.0;
@ -360,7 +360,7 @@ void BoundaryLayerTool ::CreateNewFaceDescriptors()
throw Exception("Surface " + to_string(si) + " is not a boundary of the domain to be grown into!"); throw Exception("Surface " + to_string(si) + " is not a boundary of the domain to be grown into!");
} }
void BoundaryLayerTool ::CreateFaceDescriptorsSides() void BoundaryLayerTool ::CreateFaceDescriptorsSides ()
{ {
if (insert_only_volume_elements) if (insert_only_volume_elements)
return; return;
@ -400,7 +400,7 @@ void BoundaryLayerTool ::CreateFaceDescriptorsSides()
} }
} }
void BoundaryLayerTool ::CalculateGrowthVectors() void BoundaryLayerTool ::CalculateGrowthVectors ()
{ {
growthvectors.SetSize(np); growthvectors.SetSize(np);
growthvectors = 0.; growthvectors = 0.;
@ -457,7 +457,7 @@ void BoundaryLayerTool ::CalculateGrowthVectors()
} }
Array<Array<pair<SegmentIndex, int>>, SegmentIndex> Array<Array<pair<SegmentIndex, int>>, SegmentIndex>
BoundaryLayerTool ::BuildSegMap() BoundaryLayerTool ::BuildSegMap ()
{ {
// Bit array to keep track of segments already processed // Bit array to keep track of segments already processed
BitArray segs_done(nseg + 1); BitArray segs_done(nseg + 1);
@ -536,7 +536,7 @@ BoundaryLayerTool ::BuildSegMap()
return segmap; return segmap;
} }
BitArray BoundaryLayerTool ::ProjectGrowthVectorsOnSurface() BitArray BoundaryLayerTool ::ProjectGrowthVectorsOnSurface ()
{ {
BitArray in_surface_direction(nfd_old + 1); BitArray in_surface_direction(nfd_old + 1);
in_surface_direction.Clear(); in_surface_direction.Clear();
@ -596,7 +596,7 @@ BitArray BoundaryLayerTool ::ProjectGrowthVectorsOnSurface()
return in_surface_direction; return in_surface_direction;
} }
void BoundaryLayerTool ::InsertNewElements( void BoundaryLayerTool ::InsertNewElements (
FlatArray<Array<pair<SegmentIndex, int>>, SegmentIndex> segmap, FlatArray<Array<pair<SegmentIndex, int>>, SegmentIndex> segmap,
const BitArray& in_surface_direction) const BitArray& in_surface_direction)
{ {
@ -1065,7 +1065,7 @@ void BoundaryLayerTool ::InsertNewElements(
} }
} }
void BoundaryLayerTool ::SetDomInOut() void BoundaryLayerTool ::SetDomInOut ()
{ {
if (insert_only_volume_elements) if (insert_only_volume_elements)
return; return;
@ -1081,7 +1081,7 @@ void BoundaryLayerTool ::SetDomInOut()
} }
} }
void BoundaryLayerTool ::SetDomInOutSides() void BoundaryLayerTool ::SetDomInOutSides ()
{ {
// Set the domin/domout entries for face descriptors on the "side" of new boundary layers // Set the domin/domout entries for face descriptors on the "side" of new boundary layers
if (insert_only_volume_elements) if (insert_only_volume_elements)
@ -1155,7 +1155,7 @@ void BoundaryLayerTool ::SetDomInOutSides()
} }
} }
void BoundaryLayerTool ::AddSegments() void BoundaryLayerTool ::AddSegments ()
{ {
auto& new_segs = auto& new_segs =
insert_only_volume_elements ? new_segments_on_moved_bnd : new_segments; insert_only_volume_elements ? new_segments_on_moved_bnd : new_segments;
@ -1199,14 +1199,14 @@ void BoundaryLayerTool ::AddSegments()
mesh.AddSegment(seg); mesh.AddSegment(seg);
} }
void BoundaryLayerTool ::AddSurfaceElements() void BoundaryLayerTool ::AddSurfaceElements ()
{ {
for (auto& sel : for (auto& sel :
insert_only_volume_elements ? new_sels_on_moved_bnd : new_sels) insert_only_volume_elements ? new_sels_on_moved_bnd : new_sels)
mesh.AddSurfaceElement(sel); mesh.AddSurfaceElement(sel);
} }
void BoundaryLayerTool ::ProcessParameters() void BoundaryLayerTool ::ProcessParameters ()
{ {
if (int* bc = get_if<int>(&params.boundary); bc) if (int* bc = get_if<int>(&params.boundary); bc)
{ {
@ -1374,7 +1374,7 @@ void BoundaryLayerTool ::ProcessParameters()
domains.Invert(); domains.Invert();
} }
void BoundaryLayerTool ::Perform() void BoundaryLayerTool ::Perform ()
{ {
if (domains.NumSet() == 0) if (domains.NumSet() == 0)
return; return;

View File

@ -22,15 +22,15 @@ struct SpecialBoundaryPoint
Vec<3> growth_vector; Vec<3> growth_vector;
Array<PointIndex> new_points; Array<PointIndex> new_points;
GrowthGroup(FlatArray<int> faces_, FlatArray<Vec<3>> normals); GrowthGroup (FlatArray<int> faces_, FlatArray<Vec<3>> normals);
GrowthGroup(const GrowthGroup&) = default; GrowthGroup (const GrowthGroup&) = default;
GrowthGroup() = default; GrowthGroup () = default;
}; };
Array<GrowthGroup> growth_groups; Array<GrowthGroup> growth_groups;
Vec<3> separating_direction; Vec<3> separating_direction;
SpecialBoundaryPoint(const std::map<int, Vec<3>>& normals); SpecialBoundaryPoint (const std::map<int, Vec<3>>& normals);
SpecialBoundaryPoint() = default; SpecialBoundaryPoint () = default;
}; };
DLL_HEADER void GenerateBoundaryLayer (Mesh& mesh, DLL_HEADER void GenerateBoundaryLayer (Mesh& mesh,
@ -41,7 +41,7 @@ DLL_HEADER int /* new_domain_number */ GenerateBoundaryLayer2 (Mesh& mesh, int d
class BoundaryLayerTool class BoundaryLayerTool
{ {
public: public:
BoundaryLayerTool(Mesh& mesh_, const BoundaryLayerParameters& params_); BoundaryLayerTool (Mesh& mesh_, const BoundaryLayerParameters& params_);
void ProcessParameters (); void ProcessParameters ();
void Perform (); void Perform ();

View File

@ -70,7 +70,7 @@ BuildNeighbors (FlatArray<PointIndex> points, const Mesh& mesh)
return neighbors; return neighbors;
} }
void BoundaryLayerTool ::InterpolateGrowthVectors() void BoundaryLayerTool ::InterpolateGrowthVectors ()
{ {
point_types.SetSize(mesh.GetNP()); point_types.SetSize(mesh.GetNP());
for (auto p : mesh.Points().Range()) for (auto p : mesh.Points().Range())
@ -299,7 +299,7 @@ void BoundaryLayerTool ::InterpolateGrowthVectors()
} }
} }
void BoundaryLayerTool ::InterpolateSurfaceGrowthVectors() void BoundaryLayerTool ::InterpolateSurfaceGrowthVectors ()
{ {
static Timer tall("InterpolateSurfaceGrowthVectors"); static Timer tall("InterpolateSurfaceGrowthVectors");
RegionTimer rtall(tall); RegionTimer rtall(tall);
@ -399,7 +399,7 @@ void BoundaryLayerTool ::InterpolateSurfaceGrowthVectors()
growthvectors[pi] += corrections[pi]; growthvectors[pi] += corrections[pi];
} }
void BoundaryLayerTool ::FixSurfaceElements() void BoundaryLayerTool ::FixSurfaceElements ()
{ {
static Timer tall("FixSurfaceElements"); static Timer tall("FixSurfaceElements");
RegionTimer rtall(tall); RegionTimer rtall(tall);

View File

@ -29,7 +29,7 @@ struct GrowthVectorLimiter
Array<PointIndex, PointIndex> map_from; Array<PointIndex, PointIndex> map_from;
Table<SurfaceElementIndex, PointIndex> p2sel; Table<SurfaceElementIndex, PointIndex> p2sel;
GrowthVectorLimiter(BoundaryLayerTool& tool_) GrowthVectorLimiter (BoundaryLayerTool& tool_)
: tool(tool_), params(tool_.params), mesh(tool_.mesh), height(tool_.total_height), growthvectors(tool_.growthvectors), map_from(mesh.Points().Size()) : tool(tool_), params(tool_.params), mesh(tool_.mesh), height(tool_.total_height), growthvectors(tool_.growthvectors), map_from(mesh.Points().Size())
{ {
changed_domains = tool.domains; changed_domains = tool.domains;
@ -287,7 +287,7 @@ struct GrowthVectorLimiter
if (factor == 0.0) if (factor == 0.0)
return; return;
// for (PointIndex pi : IntRange(tool.np, mesh.GetNP())) // for (PointIndex pi : IntRange(tool.np, mesh.GetNP()))
for (PointIndex pi : mesh.Points().Range().Modify(tool.np,0)) for (PointIndex pi : mesh.Points().Range().Modify(tool.np, 0))
{ {
// auto pi_from = map_from[pi]; // auto pi_from = map_from[pi];
std::set<PointIndex> pis; std::set<PointIndex> pis;
@ -464,8 +464,7 @@ struct GrowthVectorLimiter
} }
template <typename TFunc> template <typename TFunc>
void FindTreeIntersections (double trig_shift, double seg_shift, TFunc f, void FindTreeIntersections (double trig_shift, double seg_shift, TFunc f, TBitArray<PointIndex>* relevant_points = nullptr)
TBitArray<PointIndex> * relevant_points = nullptr)
{ {
static Timer t("GrowthVectorLimiter::FindTreeIntersections"); static Timer t("GrowthVectorLimiter::FindTreeIntersections");
RegionTimer rt(t); RegionTimer rt(t);
@ -629,7 +628,7 @@ struct GrowthVectorLimiter
size_t limit_counter = 1; size_t limit_counter = 1;
TBitArray<PointIndex> relevant_points, relevant_points_next; TBitArray<PointIndex> relevant_points, relevant_points_next;
relevant_points.SetSize(mesh.Points().Size() + 1); relevant_points.SetSize(mesh.Points().Size() + 1);
relevant_points_next.SetSize(mesh.Points().Size() + 1); relevant_points_next.SetSize(mesh.Points().Size() + 1);
relevant_points.Set(); relevant_points.Set();