Merge branch 'unv_meshes' into 'master'

read bbnd for .unv meshes and update topology

See merge request jschoeberl/netgen!159
This commit is contained in:
Joachim Schöberl 2019-05-02 15:36:17 +00:00
commit b49b506495

View File

@ -149,6 +149,16 @@ namespace netgen
switch (fe_id) switch (fe_id)
{ {
case 22: // (Tapered beam) SEGM
{
Segment el;
el[0] = nodes[0];
el[1] = nodes[2];
el[2] = nodes[1];
auto nr = mesh.AddSegment (el);
element_map[label] = std::make_tuple(nr+1, 2);
break;
}
case 41: // TRIG case 41: // TRIG
{ {
Element2d el (TRIG); Element2d el (TRIG);
@ -191,6 +201,9 @@ namespace netgen
element_map[label] = std::make_tuple(nr+1, 0); element_map[label] = std::make_tuple(nr+1, 0);
break; break;
} }
default:
cout << "Do not know fe_id = " << fe_id << ", skipping it." << endl;
break;
} }
} }
cout << mesh.GetNE() << " elements found" << endl; cout << mesh.GetNE() << " elements found" << endl;
@ -212,36 +225,64 @@ namespace netgen
in >> name; in >> name;
cout << len << " element are in group " << name << endl; cout << len << " element are in group " << name << endl;
int hi, index; int hi, index;
int fdnr; int fdnr, ednr;
bool is_boundary=false;
in >> hi >> index >> hi >> hi;
int codim = get<1>(element_map[index]);
// use first element to determine if boundary or volume // use first element to determine if boundary or volume
in >> hi >> index >> hi >> hi;
if (get<1>(element_map[index]) == 1) switch (codim)
{ {
is_boundary=true; case 0:
{
mesh.SetMaterial(++matnr, name);
mesh.VolumeElement(get<0>(element_map[index])).SetIndex(matnr);
break;
} }
cout << "Group " << name << (is_boundary ? " is boundary" : " is volume") << endl; case 1:
if(is_boundary)
{ {
int bcpr = mesh.GetNFD()+1; int bcpr = mesh.GetNFD()+1;
fdnr = mesh.AddFaceDescriptor(FaceDescriptor(bcpr, 0,0,0)); fdnr = mesh.AddFaceDescriptor(FaceDescriptor(bcpr, 0,0,0));
mesh.GetFaceDescriptor(fdnr).SetBCProperty(bcpr+1); mesh.GetFaceDescriptor(fdnr).SetBCProperty(bcpr+1);
mesh.SetBCName(bcpr, name); mesh.SetBCName(bcpr, name);
mesh.SurfaceElement(get<0>(element_map[index])).SetIndex(fdnr); mesh.SurfaceElement(get<0>(element_map[index])).SetIndex(fdnr);
break;
} }
else case 2:
{ {
mesh.SetMaterial(++matnr, name); int bcpr = mesh.GetNCD2Names()+1;
mesh.VolumeElement(get<0>(element_map[index])).SetIndex(matnr); auto ed = EdgeDescriptor();
ed.SetSurfNr(0,bcpr);//?
ednr = mesh.AddEdgeDescriptor(ed);
mesh.SetCD2Name(bcpr, name);
string * bcname = new string(name);
mesh.LineSegment(get<0>(element_map[index])).SetBCName(bcname);
break;
} }
default:
{
cout << "Codim " << codim << " not implemented yet!" << endl;
}
}
for(int i=0; i<len-1; i++) for(int i=0; i<len-1; i++)
{ {
in >> hi >> index >> hi >> hi; in >> hi >> index >> hi >> hi;
if(is_boundary) switch (codim)
mesh.SurfaceElement(get<0>(element_map[index])).SetIndex(fdnr); {
else case 0:
mesh.VolumeElement(get<0>(element_map[index])).SetIndex(matnr); mesh.VolumeElement(get<0>(element_map[index])).SetIndex(matnr);
break;
case 1:
mesh.SurfaceElement(get<0>(element_map[index])).SetIndex(fdnr);
break;
case 2:
mesh.LineSegment(get<0>(element_map[index])).edgenr = ednr+1;
break;
default:
break;
}
} }
} }
} }
@ -262,6 +303,7 @@ namespace netgen
mesh.ComputeNVertices(); mesh.ComputeNVertices();
mesh.RebuildSurfaceElementLists(); mesh.RebuildSurfaceElementLists();
mesh.GetBox (pmin, pmax); mesh.GetBox (pmin, pmax);
mesh.UpdateTopology();
cout << "bounding-box = " << pmin << "-" << pmax << endl; cout << "bounding-box = " << pmin << "-" << pmax << endl;
} }