mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-24 21:10:33 +05:00
mesh identify periodic for non tet meshes
This commit is contained in:
parent
bff0e67576
commit
1f78f900dd
@ -6115,15 +6115,19 @@ namespace netgen
|
||||
|
||||
int Mesh::IdentifyPeriodicBoundaries(const string &s1,
|
||||
const string &s2,
|
||||
const Transformation<3> &mapping)
|
||||
const Transformation<3> &mapping,
|
||||
double pointTolerance)
|
||||
{
|
||||
auto nr = ident->GetMaxNr() + 1;
|
||||
ident->SetType(nr, Identifications::PERIODIC);
|
||||
double lami[4];
|
||||
set<int> identified_points;
|
||||
if(pointTolerance < 0.)
|
||||
{
|
||||
Point3d pmin, pmax;
|
||||
GetBox(pmin, pmax);
|
||||
auto eps = 1e-8 * (pmax-pmin).Length();
|
||||
pointTolerance = 1e-8 * (pmax-pmin).Length();
|
||||
}
|
||||
for(const auto& se : surfelements)
|
||||
{
|
||||
if(GetBCName(se.index-1) != s1)
|
||||
@ -6138,14 +6142,18 @@ namespace netgen
|
||||
auto other_nr = GetElementOfPoint(mapped_pt, lami, true);
|
||||
int index = -1;
|
||||
auto other_el = VolumeElement(other_nr);
|
||||
for(auto i : Range(4))
|
||||
if((mapped_pt - (*this)[other_el.PNums()[i]]).Length() < eps)
|
||||
for(auto i : Range(other_el.PNums().Size()))
|
||||
if((mapped_pt - (*this)[other_el.PNums()[i]]).Length() < pointTolerance)
|
||||
{
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
if(index == -1)
|
||||
throw Exception("Did not find mapped point, are you sure your mesh is periodic?");
|
||||
{
|
||||
cout << "point coordinates = " << pt << endl;
|
||||
cout << "mapped coordinates = " << mapped_pt << endl;
|
||||
throw Exception("Did not find mapped point with nr " + ToString(pi) + ", are you sure your mesh is periodic?");
|
||||
}
|
||||
auto other_pi = other_el.PNums()[index];
|
||||
identified_points.insert(pi);
|
||||
ident->Add(pi, other_pi, nr);
|
||||
|
@ -712,7 +712,8 @@ namespace netgen
|
||||
|
||||
int IdentifyPeriodicBoundaries(const string& s1,
|
||||
const string& s2,
|
||||
const Transformation<3>& mapping);
|
||||
const Transformation<3>& mapping,
|
||||
double pointTolerance);
|
||||
|
||||
// #ifdef NONE
|
||||
// /*
|
||||
|
@ -855,7 +855,8 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m)
|
||||
py::arg("pid2"),
|
||||
py::arg("identnr"),
|
||||
py::arg("type"))
|
||||
.def("IdentifyPeriodicBoundaries", &Mesh::IdentifyPeriodicBoundaries)
|
||||
.def("IdentifyPeriodicBoundaries", &Mesh::IdentifyPeriodicBoundaries,
|
||||
py::arg("face1"), py::arg("face2"), py::arg("mapping"), py::arg("point_tolerance") = -1.)
|
||||
.def("GetNrIdentifications", [](Mesh& self)
|
||||
{
|
||||
return self.GetIdentifications().GetMaxNr();
|
||||
|
Loading…
Reference in New Issue
Block a user