Fix boundarynames from occgeo created with global bc map

This commit is contained in:
Christopher Lackner 2021-09-17 16:23:01 +02:00
parent 46a6062bdf
commit 22344e43a6
2 changed files with 22 additions and 39 deletions

View File

@ -595,8 +595,9 @@ namespace netgen
alledgeparams[geomedgenr-1] = params; alledgeparams[geomedgenr-1] = params;
} }
if(geom.enames.Size() && geom.enames[curr-1] != "") auto name = geom.enames[geom.emap.FindIndex(edge)-1];
mesh.SetCD2Name(geomedgenr, geom.enames[curr-1]); if(geom.enames.Size() && name != "")
mesh.SetCD2Name(geomedgenr, name);
(*testout) << "NP = " << mesh.GetNP() << endl; (*testout) << "NP = " << mesh.GetNP() << endl;
//(*testout) << pnums[pnums.Size()-1] << endl; //(*testout) << pnums[pnums.Size()-1] << endl;

View File

@ -54,50 +54,32 @@ namespace netgen
BuildFMap(); BuildFMap();
CalcBoundingBox(); CalcBoundingBox();
TopExp_Explorer e, exp1; snames.SetSize(somap.Size());
for (e.Init(shape, TopAbs_SOLID); e.More(); e.Next()) for(auto i : Range(snames))
snames[i] = "domain_" + ToString(i+1);
for (TopExp_Explorer e(shape, TopAbs_SOLID); e.More(); e.Next())
{ {
TopoDS_Solid solid = TopoDS::Solid(e.Current()); TopoDS_Solid solid = TopoDS::Solid(e.Current());
/*
string name = global_shape_names[solid.TShape()];
if (name == "")
name = string("domain_") + ToString(snames.Size());
snames.Append(name);
*/
if (auto name = global_shape_properties[solid.TShape()].name) if (auto name = global_shape_properties[solid.TShape()].name)
snames.Append(*name); snames[somap.FindIndex(solid)-1] = *name;
else
snames.Append(string("domain_") + ToString(snames.Size()));
} }
for (e.Init(shape, TopAbs_FACE); e.More(); e.Next()) fnames.SetSize(fmap.Size());
for(auto i : Range(fnames))
fnames[i] = "bc_" + ToString(i+1);
for(TopExp_Explorer e(shape, TopAbs_FACE); e.More(); e.Next())
{ {
TopoDS_Face face = TopoDS::Face(e.Current()); TopoDS_Face face = TopoDS::Face(e.Current());
/*
string name = global_shape_names[face.TShape()];
if (name == "")
name = string("bc_") + ToString(fnames.Size());
fnames.Append(name);
*/
if (auto name = global_shape_properties[face.TShape()].name) if (auto name = global_shape_properties[face.TShape()].name)
fnames.Append(*name); fnames[fmap.FindIndex(face)-1] = *name;
else }
fnames.Append(string("bc_") + ToString(fnames.Size())); enames.SetSize(emap.Size());
enames = "";
for (exp1.Init(face, TopAbs_EDGE); exp1.More(); exp1.Next()) for (TopExp_Explorer e(shape, TopAbs_EDGE); e.More(); e.Next())
{ {
TopoDS_Edge edge = TopoDS::Edge(exp1.Current()); TopoDS_Edge edge = TopoDS::Edge(e.Current());
// name = STEP_GetEntityName(edge,&reader); if (auto name = global_shape_properties[edge.TShape()].name)
// cout << "getname = " << name << ", mapname = " << shape_names[edge.TShape()] << endl; enames[emap.FindIndex(edge)-1] = *name;
/*
name = global_shape_names[edge.TShape()];
enames.Append(name);
*/
if (auto name = global_shape_properties[edge.TShape()].name)
enames.Append(*name);
else
enames.Append("noname-edge");
}
} }
} }