bcnames - string as reference

This commit is contained in:
Joachim Schoeberl 2012-11-09 07:27:26 +00:00
parent ce505100a5
commit 81a3f3ff8a
6 changed files with 14 additions and 18 deletions

View File

@ -5588,14 +5588,16 @@ namespace netgen
bcnames[bcnr] = 0; bcnames[bcnr] = 0;
} }
string Mesh ::GetBCName ( int bcnr ) const const string & Mesh ::GetBCName ( int bcnr ) const
{ {
static string defaultstring = "default";
if ( !bcnames.Size() ) if ( !bcnames.Size() )
return "default"; return defaultstring;
if ( bcnames[bcnr] ) if ( bcnames[bcnr] )
return *bcnames[bcnr]; return *bcnames[bcnr];
else else
return "default"; return defaultstring;
} }
void Mesh :: SetUserData(const char * id, Array<int> & data) void Mesh :: SetUserData(const char * id, Array<int> & data)

View File

@ -585,7 +585,7 @@ namespace netgen
DLL_HEADER void SetBCName ( int bcnr, const string & abcname ); DLL_HEADER void SetBCName ( int bcnr, const string & abcname );
string GetBCName ( int bcnr ) const; const string & GetBCName ( int bcnr ) const;
string * GetBCNamePtr ( int bcnr ) string * GetBCNamePtr ( int bcnr )
{ return bcnames[bcnr]; } { return bcnames[bcnr]; }

View File

@ -44,7 +44,6 @@ namespace netgen
meshopt.ImproveMesh(mesh, mp); meshopt.ImproveMesh(mesh, mp);
break; break;
} }
case 'c': case 'c':
{ {
MeshOptimize2d meshopt; MeshOptimize2d meshopt;

View File

@ -2311,13 +2311,11 @@ namespace netgen
} }
string FaceDescriptor :: GetBCName () const const string & FaceDescriptor :: GetBCName () const
{ {
if ( bcname ) static string defaultstring = "default";
return *bcname; if (bcname) return *bcname;
else return defaultstring;
return "default";
} }
/* /*

View File

@ -847,12 +847,10 @@ namespace netgen
const string * BCNamePtr () const const string * BCNamePtr () const
{ return bcname; } { return bcname; }
string GetBCName () const const string & GetBCName () const
{ {
if (! bcname ) static string defaultstring = "default";
{ if (! bcname ) return defaultstring;
return "default";
}
return *bcname; return *bcname;
} }
@ -934,7 +932,7 @@ namespace netgen
// Philippose - 06/07/2009 // Philippose - 06/07/2009
// Get Surface colour // Get Surface colour
Vec3d SurfColour () const { return surfcolour; } Vec3d SurfColour () const { return surfcolour; }
string GetBCName () const; const string & GetBCName () const;
// string * BCNamePtr () { return bcname; } // string * BCNamePtr () { return bcname; }
// const string * BCNamePtr () const { return bcname; } // const string * BCNamePtr () const { return bcname; }
void SetSurfNr (int sn) { surfnr = sn; } void SetSurfNr (int sn) { surfnr = sn; }

View File

@ -865,7 +865,6 @@ namespace netgen
// (*testout) << "x = " << x << endl; // (*testout) << "x = " << x << endl;
} }
Point3d origp = mesh[pi]; Point3d origp = mesh[pi];
int loci = 1; int loci = 1;
double fact = 1; double fact = 1;