remove any again

This commit is contained in:
Christopher Lackner 2019-08-06 20:03:17 +02:00
parent 31a9cd1bfb
commit fd42f24d37
6 changed files with 10 additions and 18 deletions

View File

@ -19,7 +19,6 @@
#include <thread>
#include <mutex>
#include <atomic>
#include <any>
#include <new>
#include <string>

View File

@ -1270,7 +1270,7 @@ namespace netgen
///
bool autozrefine = false;
any geometrySpecificParameters;
Flags geometrySpecificParameters;
///
MeshingParameters ();
///

View File

@ -194,8 +194,8 @@ DLL_HEADER void ExportSTL(py::module & m)
MeshingParameters* pars, py::kwargs kwargs)
{
MeshingParameters mp;
STLParameters stlparam;
{ py::gil_scoped_acquire aq;
STLParameters stlparam;
if(pars)
{
try
@ -203,20 +203,18 @@ DLL_HEADER void ExportSTL(py::module & m)
auto mp_flags = any_cast<Flags>(pars->geometrySpecificParameters);
auto mp_kwargs = CreateDictFromFlags(mp_flags);
CreateSTLParametersFromKwargs(stlparam, mp_kwargs);
pars->geometrySpecificParameters.reset();
}
catch(std::bad_any_cast) {}
mp = *pars;
}
CreateSTLParametersFromKwargs(stlparam, kwargs);
CreateMPfromKwargs(mp, kwargs); // this will throw if any kwargs are not passed
mp.geometrySpecificParameters = stlparam;
}
auto mesh = make_shared<Mesh>();
mesh->SetGeometry(geo);
ng_geometry = geo;
SetGlobalMesh(mesh);
geo->GenerateMesh(mesh,mp);
STLMeshingDummy(geo.get(), mesh, mp, stlparam);
return mesh;
}, py::arg("mp") = nullptr,
py::call_guard<py::gil_scoped_release>(),

View File

@ -99,10 +99,6 @@ extern STLParameters stlparam;
int STLGeometry :: GenerateMesh (shared_ptr<Mesh> & mesh, MeshingParameters & mparam)
{
STLParameters stlpar = stlparam;
if(mparam.geometrySpecificParameters.has_value() && mparam.geometrySpecificParameters.type().name() == typeid(STLParameters).name())
{
stlpar = any_cast<STLParameters>(mparam.geometrySpecificParameters);
}
return STLMeshingDummy (this, mesh, mparam, stlpar);
}

View File

@ -184,14 +184,14 @@ namespace netgen
STLGeometry();
virtual ~STLGeometry();
void DoArchive(Archive& ar)
void DoArchive(Archive& ar) override
{
STLTopology::DoArchive(ar);
}
void Clear();
virtual void Save (string filename) const;
virtual void Save (string filename) const override;
DLL_HEADER void STLInfo(double* data);
@ -330,8 +330,8 @@ namespace netgen
///
///ReadTriangle->STLTriangle, initialise some important variables, always after load!!!
virtual void InitSTLGeometry (const NgArray<STLReadTriangle> & readtrigs);
virtual void TopologyChanged(); //do some things, if topology changed!
virtual void InitSTLGeometry (const NgArray<STLReadTriangle> & readtrigs) override;
virtual void TopologyChanged() override; //do some things, if topology changed!
int CheckGeometryOverlapping();
//get NO edges per point
@ -457,10 +457,9 @@ namespace netgen
friend class MeshingSTLSurface;
virtual int GenerateMesh (shared_ptr<Mesh> & mesh, MeshingParameters & mparam);
int GenerateMesh (shared_ptr<Mesh> & mesh, MeshingParameters & mparam) override;
virtual const Refinement & GetRefinement () const;
virtual const Refinement & GetRefinement () const override;
};

View File

@ -230,7 +230,7 @@ DLL_HEADER extern STLDoctorParams stldoctor;
// TODO change enable flag to optional parameters
class STLParameters
class DLL_HEADER STLParameters
{
public:
/// angle for edge detection