mirror of
https://github.com/NGSolve/netgen.git
synced 2024-11-14 18:08:33 +05:00
Allow vector<int> as domain, project_boundaries in BoundaryLayerParameters
This commit is contained in:
parent
2ff62bc283
commit
7f8172aaf6
@ -1571,10 +1571,19 @@ namespace netgen
|
|||||||
|
|
||||||
if(params.project_boundaries.has_value())
|
if(params.project_boundaries.has_value())
|
||||||
{
|
{
|
||||||
regex pattern(*params.project_boundaries);
|
auto proj_bnd = *params.project_boundaries;
|
||||||
for(int i = 1; i<=mesh.GetNFD(); i++)
|
if(string* s = get_if<string>(&proj_bnd); s)
|
||||||
if(regex_match(mesh.GetFaceDescriptor(i).GetBCName(), pattern))
|
{
|
||||||
par_project_boundaries.Append(i);
|
regex pattern(*s);
|
||||||
|
for(int i = 1; i<=mesh.GetNFD(); i++)
|
||||||
|
if(regex_match(mesh.GetFaceDescriptor(i).GetBCName(), pattern))
|
||||||
|
par_project_boundaries.Append(i);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for(auto id : *get_if<std::vector<int>>(&proj_bnd))
|
||||||
|
par_project_boundaries.Append(id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(double* height = get_if<double>(¶ms.thickness); height)
|
if(double* height = get_if<double>(¶ms.thickness); height)
|
||||||
@ -1598,10 +1607,14 @@ namespace netgen
|
|||||||
if(regex_match(mesh.GetMaterial(i), pattern))
|
if(regex_match(mesh.GetMaterial(i), pattern))
|
||||||
domains.SetBit(i);
|
domains.SetBit(i);
|
||||||
}
|
}
|
||||||
|
else if(int *idomain = get_if<int>(¶ms.domain); idomain)
|
||||||
|
{
|
||||||
|
domains.SetBit(*idomain);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto idomain = *get_if<int>(¶ms.domain);
|
for (auto i : *get_if<std::vector<int>>(¶ms.domain))
|
||||||
domains.SetBit(idomain);
|
domains.SetBit(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2907,42 +2907,30 @@ namespace netgen
|
|||||||
|
|
||||||
ostream & operator<< (ostream & ost, const BoundaryLayerParameters & mp)
|
ostream & operator<< (ostream & ost, const BoundaryLayerParameters & mp)
|
||||||
{
|
{
|
||||||
|
auto print_vec = [&ost](auto & v) {
|
||||||
|
ost << "[";
|
||||||
|
for (const auto & val : v)
|
||||||
|
ost << val << " ";
|
||||||
|
ost << "]";
|
||||||
|
};
|
||||||
ost << "BoundaryLayerParameters" << endl;
|
ost << "BoundaryLayerParameters" << endl;
|
||||||
ost << " boundary: ";
|
ost << " boundary: ";
|
||||||
switch(mp.boundary.index())
|
switch(mp.boundary.index())
|
||||||
{
|
{
|
||||||
case 0:
|
case 0: ost << std::get<0>(mp.boundary); break;
|
||||||
ost << std::get<0>(mp.boundary);
|
case 1: ost << std::get<1>(mp.boundary); break;
|
||||||
break;
|
case 2: print_vec(std::get<2>(mp.boundary)); break;
|
||||||
case 1:
|
|
||||||
ost << std::get<1>(mp.boundary);
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
ost << "[";
|
|
||||||
for (auto val : std::get<2>(mp.boundary))
|
|
||||||
ost << val << " ";
|
|
||||||
ost << "]";
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
ost << "\n thickness: ";
|
ost << "\n thickness: ";
|
||||||
switch(mp.thickness.index())
|
switch(mp.thickness.index())
|
||||||
{
|
{
|
||||||
case 0:
|
case 0: ost << std::get<0>(mp.thickness); break;
|
||||||
ost << std::get<0>(mp.thickness);
|
case 1: print_vec(std::get<1>(mp.thickness)); break;
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
ost << "[";
|
|
||||||
for (auto val : std::get<1>(mp.thickness))
|
|
||||||
ost << val << " ";
|
|
||||||
ost << "]";
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
ost <<"\n new_material: ";
|
ost <<"\n new_material: ";
|
||||||
switch(mp.new_material.index())
|
switch(mp.new_material.index())
|
||||||
{
|
{
|
||||||
case 0:
|
case 0: ost << std::get<0>(mp.new_material); break;
|
||||||
ost << std::get<0>(mp.new_material);
|
|
||||||
break;
|
|
||||||
case 1:
|
case 1:
|
||||||
for (const auto & [key, value] : std::get<1>(mp.new_material))
|
for (const auto & [key, value] : std::get<1>(mp.new_material))
|
||||||
ost << key << " -> " << value << ", ";
|
ost << key << " -> " << value << ", ";
|
||||||
@ -2951,15 +2939,22 @@ namespace netgen
|
|||||||
ost << "\n domain: ";
|
ost << "\n domain: ";
|
||||||
switch(mp.domain.index())
|
switch(mp.domain.index())
|
||||||
{
|
{
|
||||||
case 0:
|
case 0: ost << std::get<0>(mp.domain); break;
|
||||||
ost << std::get<0>(mp.domain);
|
case 1: ost << std::get<1>(mp.domain); break;
|
||||||
break;
|
case 2: print_vec(std::get<2>(mp.domain)); break;
|
||||||
case 1:
|
|
||||||
ost << std::get<1>(mp.domain);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
ost << "\n outside: " << mp.outside;
|
ost << "\n outside: " << mp.outside;
|
||||||
ost << "\n project_boundaries: " << (mp.project_boundaries ? ToString(*mp.project_boundaries) : "nullopt");
|
ost << "\n project_boundaries: ";
|
||||||
|
if(mp.project_boundaries) {
|
||||||
|
auto & proj_bnd = *mp.project_boundaries;
|
||||||
|
switch(proj_bnd.index())
|
||||||
|
{
|
||||||
|
case 0: ost << std::get<0>(proj_bnd); break;
|
||||||
|
case 1: print_vec(std::get<1>(proj_bnd)); break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
ost << "nullopt";
|
||||||
ost << "\n grow_edges: " << mp.grow_edges;
|
ost << "\n grow_edges: " << mp.grow_edges;
|
||||||
ost << "\n limit_growth_vectors: " << mp.limit_growth_vectors;
|
ost << "\n limit_growth_vectors: " << mp.limit_growth_vectors;
|
||||||
ost << "\n sides_keep_surfaceindex: " << mp.sides_keep_surfaceindex;
|
ost << "\n sides_keep_surfaceindex: " << mp.sides_keep_surfaceindex;
|
||||||
|
@ -1279,9 +1279,9 @@ namespace netgen
|
|||||||
std::variant<string, int, std::vector<int>> boundary;
|
std::variant<string, int, std::vector<int>> boundary;
|
||||||
std::variant<double, std::vector<double>> thickness;
|
std::variant<double, std::vector<double>> thickness;
|
||||||
std::variant<string, std::map<string, string>> new_material;
|
std::variant<string, std::map<string, string>> new_material;
|
||||||
std::variant<string, int> domain;
|
std::variant<string, int, std::vector<int>> domain;
|
||||||
bool outside;
|
bool outside;
|
||||||
std::optional<string> project_boundaries;
|
std::optional<std::variant<string, std::vector<int>>> project_boundaries;
|
||||||
bool grow_edges;
|
bool grow_edges;
|
||||||
bool limit_growth_vectors;
|
bool limit_growth_vectors;
|
||||||
bool sides_keep_surfaceindex;
|
bool sides_keep_surfaceindex;
|
||||||
|
@ -1472,8 +1472,8 @@ py::arg("point_tolerance") = -1.)
|
|||||||
.def ("BoundaryLayer", [](Mesh & self, variant<string, int, std::vector<int>> boundary,
|
.def ("BoundaryLayer", [](Mesh & self, variant<string, int, std::vector<int>> boundary,
|
||||||
variant<double, std::vector<double>> thickness,
|
variant<double, std::vector<double>> thickness,
|
||||||
variant<string, map<string, string>> material,
|
variant<string, map<string, string>> material,
|
||||||
variant<string, int> domain, bool outside,
|
variant<string, int, std::vector<int>> domain, bool outside,
|
||||||
optional<string> project_boundaries,
|
optional<variant<string, std::vector<int>>> project_boundaries,
|
||||||
bool grow_edges, bool limit_growth_vectors,
|
bool grow_edges, bool limit_growth_vectors,
|
||||||
bool sides_keep_surfaceindex,
|
bool sides_keep_surfaceindex,
|
||||||
bool keep_surfaceindex)
|
bool keep_surfaceindex)
|
||||||
@ -1725,9 +1725,9 @@ py::arg("point_tolerance") = -1.)
|
|||||||
std::variant<string, int, std::vector<int>> boundary,
|
std::variant<string, int, std::vector<int>> boundary,
|
||||||
std::variant<double, std::vector<double>> thickness,
|
std::variant<double, std::vector<double>> thickness,
|
||||||
std::variant<string, std::map<string, string>> new_material,
|
std::variant<string, std::map<string, string>> new_material,
|
||||||
std::variant<string, int> domain,
|
std::variant<string, int, std::vector<int>> domain,
|
||||||
bool outside,
|
bool outside,
|
||||||
std::optional<string> project_boundaries,
|
std::optional<std::variant<string, std::vector<int>>> project_boundaries,
|
||||||
bool grow_edges,
|
bool grow_edges,
|
||||||
bool limit_growth_vectors,
|
bool limit_growth_vectors,
|
||||||
bool sides_keep_surfaceindex,
|
bool sides_keep_surfaceindex,
|
||||||
|
Loading…
Reference in New Issue
Block a user