default material name

This commit is contained in:
Joachim Schöberl 2017-05-13 10:24:12 +02:00
parent ca8df788c8
commit b4f3107fef
2 changed files with 7 additions and 4 deletions

View File

@ -5758,8 +5758,8 @@ namespace netgen
{ {
int olds = materials.Size(); int olds = materials.Size();
materials.SetSize (domnr); materials.SetSize (domnr);
for (int i = olds; i < domnr; i++) for (int i = olds; i < domnr-1; i++)
materials[i] = 0; materials[i] = new string("default");
} }
/* /*
materials.Elem(domnr) = new char[strlen(mat)+1]; materials.Elem(domnr) = new char[strlen(mat)+1];
@ -5772,7 +5772,7 @@ namespace netgen
{ {
if (domnr <= materials.Size()) if (domnr <= materials.Size())
return *materials.Get(domnr); return *materials.Get(domnr);
static string emptystring; static string emptystring("default");
return emptystring; return emptystring;
} }

View File

@ -594,7 +594,10 @@ namespace netgen
/// ///
const string & GetMaterial (int domnr) const; const string & GetMaterial (int domnr) const;
const string * GetMaterialPtr (int domnr) const // 1-based const string * GetMaterialPtr (int domnr) const // 1-based
{ return domnr <= materials.Size() ? materials.Get(domnr) : nullptr; } {
static string defaultmat = "default";
return domnr <= materials.Size() ? materials.Get(domnr) : &defaultmat;
}
DLL_HEADER void SetNBCNames ( int nbcn ); DLL_HEADER void SetNBCNames ( int nbcn );