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