inline GetCD2NamePtr

This commit is contained in:
Joachim Schöberl 2017-04-03 18:15:34 +02:00
parent e1917c8d8a
commit 701d6a2369
3 changed files with 9 additions and 3 deletions

View File

@ -74,9 +74,8 @@ NGX_INLINE DLL_HEADER Ng_Element Ngx_Mesh :: GetElement<1> (size_t nr) const
ret.mat = mesh->GetBCNamePtr(el.si-1); ret.mat = mesh->GetBCNamePtr(el.si-1);
else else
{ {
if (mesh->GetDimension() == 3){ if (mesh->GetDimension() == 3)
ret.mat = &mesh->GetCD2Name(el.edgenr-1); ret.mat = mesh->GetCD2NamePtr(el.edgenr-1);
}
else else
ret.mat = nullptr; ret.mat = nullptr;
} }

View File

@ -5832,6 +5832,7 @@ namespace netgen
cd2names[cd2nr] = nullptr; cd2names[cd2nr] = nullptr;
} }
string Mesh :: cd2_default_name = "default";
const string & Mesh :: GetCD2Name (int cd2nr) const const string & Mesh :: GetCD2Name (int cd2nr) const
{ {
static string defaultstring = "default"; static string defaultstring = "default";

View File

@ -606,6 +606,12 @@ namespace netgen
DLL_HEADER void SetCD2Name (int cd2nr, const string & abcname); DLL_HEADER void SetCD2Name (int cd2nr, const string & abcname);
const string & GetCD2Name (int cd2nr ) const; const string & GetCD2Name (int cd2nr ) const;
static string cd2_default_name;
string * GetCD2NamePtr (int cd2nr ) const
{
if (cd2nr < cd2names.Size() && cd2names[cd2nr]) return cd2names[cd2nr];
return &cd2_default_name;
}
size_t GetNCD2Names() const { return cd2names.Size(); } size_t GetNCD2Names() const { return cd2names.Size(); }
string * GetBCNamePtr (int bcnr) const string * GetBCNamePtr (int bcnr) const