Merge branch 'write_identificationnames_mesh' into 'master'

write identification names into mesh

See merge request ngsolve/netgen!666
This commit is contained in:
Schöberl, Joachim 2024-08-30 11:19:08 +02:00
commit 16c49d41eb
2 changed files with 31 additions and 0 deletions

View File

@ -901,6 +901,13 @@ namespace netgen
outfile << " " << type; outfile << " " << type;
} }
outfile << "\n"; outfile << "\n";
outfile << "identificationnames\n";
outfile << ident -> GetMaxNr() << "\n";
for (i = 1; i <= ident -> GetMaxNr(); i++)
{
string name = ident -> GetName(i);
outfile << ident->GetName(i) << "\n";
}
} }
int cntmat = 0; int cntmat = 0;
@ -1451,6 +1458,17 @@ namespace netgen
ident -> SetType(i,Identifications::ID_TYPE(type)); ident -> SetType(i,Identifications::ID_TYPE(type));
} }
} }
if (strcmp (str, "identificationnames") == 0)
{
infile >> n;
PrintMessage (3, n, " identificationnames");
for (i = 1; i <= n; i++)
{
string name;
infile >> name;
ident -> SetName(i,name);
}
}
if (strcmp (str, "materials") == 0) if (strcmp (str, "materials") == 0)
{ {

View File

@ -1642,6 +1642,19 @@ namespace netgen
names.Append(name); names.Append(name);
return names.Pos(name)+1; return names.Pos(name)+1;
} }
string GetName(int nr) const
{
if (nr <= names.Size())
return names[nr - 1];
else
return "";
}
void SetName(int nr, string name)
{
while(names.Size() < nr)
names.Append("");
names[nr-1] = name;
}
/// remove secondorder /// remove secondorder
void SetMaxPointNr (int maxpnum); void SetMaxPointNr (int maxpnum);