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.tracer = tracer;
if(mesh->GetGeometry())
mesh->GetGeometry()->GetRefinement().Bisect (*mesh, biopt);
else
Refinement().Bisect(*mesh, biopt);
(*tracer)("call updatetop", false);
mesh -> UpdateTopology(task_manager, tracer);
(*tracer)("call updatetop", true);

View File

@ -798,7 +798,8 @@ namespace netgen
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)
{

View File

@ -63,10 +63,7 @@ namespace netgen
}
if (secondorder)
{
if (mesh.GetGeometry())
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
([](Mesh & self)
{
if (self.GetGeometry())
self.GetGeometry()->GetRefinement().Refine(self);
else
Refinement().Refine(self);
self.UpdateTopology();
}),py::call_guard<py::gil_scoped_release>())
.def ("SecondOrder", FunctionPointer
([](Mesh & self)
{
if (self.GetGeometry())
self.GetGeometry()->GetRefinement().MakeSecondOrder(self);
else
Refinement().MakeSecondOrder(self);
}))
.def ("GetGeometry", [] (Mesh& self) { return self.GetGeometry(); })