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 <thread>
#include <mutex> #include <mutex>
#include <atomic> #include <atomic>
#include <any>
#include <new> #include <new>
#include <string> #include <string>

View File

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

View File

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

View File

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

View File

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