mirror of
https://github.com/NGSolve/netgen.git
synced 2025-01-12 14:10:34 +05:00
Fix Mesh::operator=
bcnames are now stored in FaceDescriptor (as string members, no pointers), so the name mapping must be applied to materials/bcnames (depending on the mesh dimension).
This commit is contained in:
parent
dfba4edd26
commit
29c6b8e06f
@ -319,26 +319,27 @@ namespace netgen
|
||||
hmin = mesh2.hmin;
|
||||
maxhdomain = mesh2.maxhdomain;
|
||||
|
||||
// Remap string* values to new mesh
|
||||
std::map<const string*, string*> names_map;
|
||||
for (auto fi : Range(facedecoding))
|
||||
names_map[&mesh2.facedecoding[fi].bcname] = &facedecoding[fi].bcname;
|
||||
|
||||
materials.SetSize( mesh2.materials.Size() );
|
||||
for ( int i = 0; i < mesh2.materials.Size(); i++ )
|
||||
if ( mesh2.materials[i] ) materials[i] = new string ( *mesh2.materials[i] );
|
||||
{
|
||||
const string * old_name = mesh2.materials[i];
|
||||
if ( old_name ) materials[i] = dimension == 2 ? names_map[old_name] : new string ( *old_name );
|
||||
else materials[i] = 0;
|
||||
}
|
||||
|
||||
std::map<const string*, string*> bcmap;
|
||||
bcnames.SetSize( mesh2.bcnames.Size() );
|
||||
for ( int i = 0; i < mesh2.bcnames.Size(); i++ )
|
||||
{
|
||||
if ( mesh2.bcnames[i] ) bcnames[i] = new string ( *mesh2.bcnames[i] );
|
||||
const string * old_name = mesh2.bcnames[i];
|
||||
if ( old_name ) bcnames[i] = dimension == 3 ? names_map[old_name] : new string ( *old_name );
|
||||
else bcnames[i] = 0;
|
||||
bcmap[mesh2.bcnames[i]] = bcnames[i];
|
||||
}
|
||||
|
||||
// Remap string* members in FaceDescriptor to new mesh
|
||||
for (auto & f : facedecoding)
|
||||
f.SetBCName( bcmap[&f.GetBCName()] );
|
||||
|
||||
|
||||
cd2names.SetSize(mesh2.cd2names.Size());
|
||||
for (int i=0; i < mesh2.cd2names.Size(); i++)
|
||||
if (mesh2.cd2names[i]) cd2names[i] = new string(*mesh2.cd2names[i]);
|
||||
|
Loading…
Reference in New Issue
Block a user