mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-24 21:10:33 +05:00
read bbnd for .unv meshes and update topology
This commit is contained in:
parent
dc4b1c05b9
commit
70b5151c5c
@ -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:
|
||||||
}
|
{
|
||||||
cout << "Group " << name << (is_boundary ? " is boundary" : " is volume") << endl;
|
mesh.SetMaterial(++matnr, name);
|
||||||
if(is_boundary)
|
mesh.VolumeElement(get<0>(element_map[index])).SetIndex(matnr);
|
||||||
{
|
break;
|
||||||
int bcpr = mesh.GetNFD()+1;
|
}
|
||||||
fdnr = mesh.AddFaceDescriptor(FaceDescriptor(bcpr, 0,0,0));
|
case 1:
|
||||||
mesh.GetFaceDescriptor(fdnr).SetBCProperty(bcpr+1);
|
{
|
||||||
mesh.SetBCName(bcpr, name);
|
int bcpr = mesh.GetNFD()+1;
|
||||||
mesh.SurfaceElement(get<0>(element_map[index])).SetIndex(fdnr);
|
fdnr = mesh.AddFaceDescriptor(FaceDescriptor(bcpr, 0,0,0));
|
||||||
}
|
mesh.GetFaceDescriptor(fdnr).SetBCProperty(bcpr+1);
|
||||||
else
|
mesh.SetBCName(bcpr, name);
|
||||||
{
|
mesh.SurfaceElement(get<0>(element_map[index])).SetIndex(fdnr);
|
||||||
mesh.SetMaterial(++matnr, name);
|
break;
|
||||||
mesh.VolumeElement(get<0>(element_map[index])).SetIndex(matnr);
|
}
|
||||||
|
case 2:
|
||||||
|
{
|
||||||
|
int bcpr = mesh.GetNCD2Names()+1;
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user