mirror of
https://github.com/NGSolve/netgen.git
synced 2025-04-25 03:22:04 +05:00
common arrays of region names
This commit is contained in:
parent
42294117bd
commit
cb3eb0d355
@ -72,13 +72,16 @@ NGX_INLINE DLL_HEADER Ng_Element Ngx_Mesh :: GetElement<0> (size_t nr) const
|
||||
ret.facets.base = POINTINDEX_BASE;
|
||||
ret.facets.ptr = (int*)&el.pnum;
|
||||
|
||||
/*
|
||||
if (mesh->GetDimension() == 1)
|
||||
ret.mat = *(mesh->GetBCNamePtr(el.index-1));
|
||||
else if (mesh->GetDimension() == 2)
|
||||
ret.mat = *(mesh->GetCD2NamePtr(el.index-1));
|
||||
else
|
||||
ret.mat = *(mesh->GetCD3NamePtr(el.index-1));
|
||||
|
||||
*/
|
||||
ret.mat = mesh->GetRegionName(0, el.index);
|
||||
|
||||
ret.is_curved = false;
|
||||
return ret;
|
||||
}
|
||||
@ -97,6 +100,8 @@ NGX_INLINE DLL_HEADER Ng_Element Ngx_Mesh :: GetElement<1> (size_t nr) const
|
||||
ret.index = el.edgenr;
|
||||
else
|
||||
ret.index = el.si;
|
||||
|
||||
/*
|
||||
if (mesh->GetDimension() == 2)
|
||||
ret.mat = *(mesh->GetBCNamePtr(el.si-1));
|
||||
else
|
||||
@ -106,6 +111,8 @@ NGX_INLINE DLL_HEADER Ng_Element Ngx_Mesh :: GetElement<1> (size_t nr) const
|
||||
else
|
||||
ret.mat = *(mesh->GetMaterialPtr(el.si));
|
||||
}
|
||||
*/
|
||||
ret.mat = mesh->GetRegionName(1, ret.index);
|
||||
|
||||
ret.points.num = el.GetNP();
|
||||
ret.points.ptr = (int*)&(el[0]);
|
||||
|
@ -4828,10 +4828,7 @@ namespace netgen
|
||||
delete str;
|
||||
bcnames.SetSize(0);
|
||||
for(auto str: cd2names)
|
||||
{
|
||||
cout << "found material = " << *str << endl;
|
||||
materials.Append(str);
|
||||
}
|
||||
materials.Append(str);
|
||||
cd2names.SetSize(0);
|
||||
for(auto str : cd3names)
|
||||
bcnames.Append(str);
|
||||
@ -7416,6 +7413,7 @@ namespace netgen
|
||||
}
|
||||
|
||||
string Mesh :: defaultmat = "default";
|
||||
string_view Mesh :: defaultmat_sv = "default";
|
||||
const string & Mesh :: GetMaterial (int domnr) const
|
||||
{
|
||||
if (domnr <= materials.Size())
|
||||
|
@ -128,6 +128,13 @@ namespace netgen
|
||||
*/
|
||||
NgArray<EdgeDescriptor> edgedecoding;
|
||||
|
||||
Array<string*> region_name_cd[4];
|
||||
Array<string*> & materials = region_name_cd[0];
|
||||
Array<string*> & bcnames = region_name_cd[1];
|
||||
Array<string*> & cd2names = region_name_cd[2];
|
||||
Array<string*> & cd3names = region_name_cd[3];
|
||||
|
||||
/*
|
||||
/// sub-domain materials
|
||||
Array<string*> materials;
|
||||
|
||||
@ -139,7 +146,8 @@ namespace netgen
|
||||
|
||||
/// labels for co dim 3 bbboundary conditions
|
||||
Array<string*> cd3names;
|
||||
|
||||
*/
|
||||
|
||||
/// Periodic surface, close surface, etc. identifications
|
||||
unique_ptr<Identifications> ident;
|
||||
|
||||
@ -775,6 +783,15 @@ namespace netgen
|
||||
std::string_view GetRegionName(SegmentIndex ei) const { return GetRegionName((*this)[ei]); }
|
||||
std::string_view GetRegionName(SurfaceElementIndex ei) const { return GetRegionName((*this)[ei]); }
|
||||
std::string_view GetRegionName(ElementIndex ei) const { return GetRegionName((*this)[ei]); }
|
||||
|
||||
DLL_HEADER static string_view defaultmat_sv;
|
||||
std::string_view GetRegionName (int dim, int domnr) // 1-based domnr
|
||||
{
|
||||
domnr--;
|
||||
auto & names = region_name_cd[dimension-dim];
|
||||
if (domnr < names.Size() && names[domnr]) return *names[domnr];
|
||||
return defaultmat_sv;
|
||||
}
|
||||
|
||||
///
|
||||
void ClearFaceDescriptors()
|
||||
|
Loading…
x
Reference in New Issue
Block a user