Merge branch 'bbbnd' into 'master'

Bbbnd

See merge request jschoeberl/netgen!96
This commit is contained in:
Joachim Schöberl 2018-08-07 11:20:40 +02:00
commit 802145c2df
5 changed files with 63 additions and 4 deletions

View File

@ -226,7 +226,7 @@ namespace netgen
void AddUserPoint (const Point<3> & p, double ref_factor = 0)
{ userpoints.Append (UserPoint(p,1)); userpoints_ref_factor.Append (ref_factor); }
{ userpoints.Append (UserPoint(p,userpoints.Size()+1)); userpoints_ref_factor.Append (ref_factor); }
void AddUserPoint (const UserPoint up, double ref_factor = 0)
{ userpoints.Append (up); userpoints_ref_factor.Append (ref_factor); }
int GetNUserPoints () const

View File

@ -217,8 +217,7 @@ const string & Ngx_Mesh :: GetMaterialCD<2> (int region_nr) const
template <> NGX_INLINE DLL_HEADER
const string & Ngx_Mesh :: GetMaterialCD<3> (int region_nr) const
{
static string def("default");
return def;
return mesh->GetCD3Name(region_nr);
}

View File

@ -5985,6 +5985,48 @@ namespace netgen
return defaultstring;
}
void Mesh :: SetNCD3Names( int ncd3n )
{
if (cd3names.Size())
for(int i=0; i<cd3names.Size(); i++)
if(cd3names[i]) delete cd3names[i];
cd3names.SetSize(ncd3n);
cd3names = 0;
}
void Mesh :: SetCD3Name ( int cd3nr, const string & abcname )
{
cd3nr--;
(*testout) << "setCD3Name on vertex " << cd3nr << " to " << abcname << endl;
if (cd3nr >= cd3names.Size())
{
int oldsize = cd3names.Size();
cd3names.SetSize(cd3nr+1);
for(int i= oldsize; i<= cd3nr; i++)
cd3names[i] = nullptr;
}
if (abcname != "default")
cd3names[cd3nr] = new string(abcname);
else
cd3names[cd3nr] = nullptr;
}
string Mesh :: cd3_default_name = "default";
const string & Mesh :: GetCD3Name (int cd3nr) const
{
static string defaultstring = "default";
if (!cd3names.Size())
return defaultstring;
if (cd3nr < 0 || cd3nr >= cd3names.Size())
return defaultstring;
if (cd3names[cd3nr])
return *cd3names[cd3nr];
else
return defaultstring;
}
void Mesh :: SetUserData(const char * id, Array<int> & data)
{
if(userdata_int.Used(id))

View File

@ -96,6 +96,9 @@ namespace netgen
/// labels for co dim 2 bboundary conditions
Array<string*> cd2names;
/// labels for co dim 3 bbboundary conditions
Array<string*> cd3names;
/// Periodic surface, close surface, etc. identifications
Identifications * ident;
@ -631,6 +634,18 @@ namespace netgen
}
size_t GetNCD2Names() const { return cd2names.Size(); }
DLL_HEADER void SetNCD3Names (int ncd3n);
DLL_HEADER void SetCD3Name (int cd3nr, const string & abcname);
DLL_HEADER const string & GetCD3Name (int cd3nr ) const;
DLL_HEADER static string cd3_default_name;
string * GetCD3NamePtr (int cd3nr ) const
{
if (cd3nr < cd3names.Size() && cd3names[cd3nr]) return cd3names[cd3nr];
return &cd3_default_name;
}
size_t GetNCD3Names() const { return cd3names.Size(); }
DLL_HEADER static string default_bc;
string * GetBCNamePtr (int bcnr) const
{ return (bcnr < bcnames.Size() && bcnames[bcnr]) ? bcnames[bcnr] : &default_bc; }

View File

@ -663,7 +663,10 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m)
{ return string(self.GetMaterial(domnr)); }))
.def ("GetCD2Name", &Mesh::GetCD2Name)
.def("SetCD2Name", &Mesh::SetCD2Name)
.def ("SetCD2Name", &Mesh::SetCD2Name)
.def ("GetCD3Name", &Mesh::GetCD3Name)
.def ("SetCD3Name", &Mesh::SetCD3Name)
.def ("AddPointIdentification", [](Mesh & self, py::object pindex1, py::object pindex2, int identnr, int type)
{