return default geometry if no geometry is set for mesh

This commit is contained in:
Christopher Lackner 2019-07-30 12:40:22 +02:00
parent ec5ec39909
commit 8ae2475085
4 changed files with 7 additions and 18 deletions

View File

@ -1164,10 +1164,7 @@ namespace netgen
biopt.task_manager = task_manager; biopt.task_manager = task_manager;
biopt.tracer = tracer; biopt.tracer = tracer;
if(mesh->GetGeometry()) mesh->GetGeometry()->GetRefinement().Bisect (*mesh, biopt);
mesh->GetGeometry()->GetRefinement().Bisect (*mesh, biopt);
else
Refinement().Bisect(*mesh, biopt);
(*tracer)("call updatetop", false); (*tracer)("call updatetop", false);
mesh -> UpdateTopology(task_manager, tracer); mesh -> UpdateTopology(task_manager, tracer);
(*tracer)("call updatetop", true); (*tracer)("call updatetop", true);

View File

@ -797,8 +797,9 @@ namespace netgen
shared_ptr<NetgenGeometry> GetGeometry() const shared_ptr<NetgenGeometry> GetGeometry() const
{ {
return geometry; static auto global_geometry = make_shared<NetgenGeometry>();
return geometry ? geometry : global_geometry;
} }
void SetGeometry (shared_ptr<NetgenGeometry> geom) void SetGeometry (shared_ptr<NetgenGeometry> geom)
{ {

View File

@ -63,10 +63,7 @@ namespace netgen
} }
if (secondorder) if (secondorder)
{ {
if (mesh.GetGeometry()) mesh.GetGeometry()->GetRefinement().MakeSecondOrder(mesh);
mesh.GetGeometry()->GetRefinement().MakeSecondOrder(mesh);
else
Refinement().MakeSecondOrder(mesh);
} }
} }

View File

@ -890,20 +890,14 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m)
.def ("Refine", FunctionPointer .def ("Refine", FunctionPointer
([](Mesh & self) ([](Mesh & self)
{ {
if (self.GetGeometry()) self.GetGeometry()->GetRefinement().Refine(self);
self.GetGeometry()->GetRefinement().Refine(self);
else
Refinement().Refine(self);
self.UpdateTopology(); self.UpdateTopology();
}),py::call_guard<py::gil_scoped_release>()) }),py::call_guard<py::gil_scoped_release>())
.def ("SecondOrder", FunctionPointer .def ("SecondOrder", FunctionPointer
([](Mesh & self) ([](Mesh & self)
{ {
if (self.GetGeometry()) self.GetGeometry()->GetRefinement().MakeSecondOrder(self);
self.GetGeometry()->GetRefinement().MakeSecondOrder(self);
else
Refinement().MakeSecondOrder(self);
})) }))
.def ("GetGeometry", [] (Mesh& self) { return self.GetGeometry(); }) .def ("GetGeometry", [] (Mesh& self) { return self.GetGeometry(); })