use static class variable rather then static function variable

This commit is contained in:
Joachim Schöberl 2017-05-31 07:53:24 +02:00
parent 76e6aaecb1
commit feb74d49c2
2 changed files with 2 additions and 1 deletions

View File

@ -5768,6 +5768,7 @@ namespace netgen
materials.Elem(domnr) = new string(mat); materials.Elem(domnr) = new string(mat);
} }
string Mesh :: defaultmat = "default";
const string & Mesh :: GetMaterial (int domnr) const const string & Mesh :: GetMaterial (int domnr) const
{ {
if (domnr <= materials.Size()) if (domnr <= materials.Size())

View File

@ -593,9 +593,9 @@ namespace netgen
DLL_HEADER void SetMaterial (int domnr, const string & mat); DLL_HEADER void SetMaterial (int domnr, const string & mat);
/// ///
const string & GetMaterial (int domnr) const; const string & GetMaterial (int domnr) const;
static string defaultmat;
const string * GetMaterialPtr (int domnr) const // 1-based const string * GetMaterialPtr (int domnr) const // 1-based
{ {
static string defaultmat = "default";
return domnr <= materials.Size() ? materials.Get(domnr) : &defaultmat; return domnr <= materials.Size() ? materials.Get(domnr) : &defaultmat;
} }