v0.16.3
Loading...
Searching...
No Matches
SDFPython.hpp
Go to the documentation of this file.
1/** \file SDFPython.hpp
2 * \brief Reusable vectorised Python signed-distance evaluator.
3 */
4#ifndef MOFEM_SDF_PYTHON_HPP
5#define MOFEM_SDF_PYTHON_HPP
6
7#include <array>
8#include <memory>
9#include <string>
10
11namespace MoFEM {
12
13/** Python/NumPy must be initialised before loading a script. Destroy evaluators
14 * before finalising Python. Each evaluator has an independent script namespace.
15 */
16struct SDFPython {
18 ~SDFPython();
19 SDFPython(const SDFPython &) = delete;
20 SDFPython &operator=(const SDFPython &) = delete;
21
23 static MoFEMErrorCode finalise();
24 MoFEMErrorCode sdfInit(const std::string &file);
26 MoFEMErrorCode evalSdf(double dt, double t, const MatrixDouble &coordinates,
27 const MatrixDouble &normals, int block,
28 VectorDouble &values) const;
29 MoFEMErrorCode evalGradSdf(double dt, double t,
31 const MatrixDouble &normals, int block,
32 MatrixDouble &values) const;
33 MoFEMErrorCode evalHessSdf(double dt, double t,
35 const MatrixDouble &normals, int block,
36 MatrixDouble &values) const;
37
38 /** Scalar adapter for implicit geometry; contact-normal arguments are zero. */
39 double value(const std::array<double, 3> &point, double dt = 0, double t = 0,
40 int block = 0) const;
41
42private:
43 struct Impl;
44 std::unique_ptr<Impl> impl;
45};
46
47} // namespace MoFEM
48#endif
Vec t
Removal: the ring edge.
std::vector< std::array< double, 3 > > coordinates
SmartPetscObj< Vec > values
double dt
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
implementation of Data Operators for Forces and Sources
Definition Common.hpp:10
SDFPython & operator=(const SDFPython &)=delete
MoFEMErrorCode requireDerivatives() const
static MoFEMErrorCode initialise()
Definition SDFPython.cpp:84
MoFEMErrorCode evalHessSdf(double dt, double t, const MatrixDouble &coordinates, const MatrixDouble &normals, int block, MatrixDouble &values) const
MoFEMErrorCode sdfInit(const std::string &file)
double value(const std::array< double, 3 > &point, double dt=0, double t=0, int block=0) const
MoFEMErrorCode evalSdf(double dt, double t, const MatrixDouble &coordinates, const MatrixDouble &normals, int block, VectorDouble &values) const
SDFPython(const SDFPython &)=delete
static MoFEMErrorCode finalise()
std::unique_ptr< Impl > impl
Definition SDFPython.hpp:44
MoFEMErrorCode evalGradSdf(double dt, double t, const MatrixDouble &coordinates, const MatrixDouble &normals, int block, MatrixDouble &values) const