diff --git a/Mesh/CMakeLists.txt b/Mesh/CMakeLists.txt index e35ef4c5995df9766d6a86cf4a626b04fd92c3e2..8be2b1b55c48c93aa1233fe2a0a20f40c6ba378f 100644 --- a/Mesh/CMakeLists.txt +++ b/Mesh/CMakeLists.txt @@ -32,6 +32,7 @@ set(SRC Field.cpp filterElements.cpp gmshCrossFields.cpp + automaticMeshSizeField.cpp ) file(GLOB HDR RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.h) diff --git a/Mesh/Field.cpp b/Mesh/Field.cpp index cf2b70633c6141dcfe4415756da8459ca84bc148..af600a04559d7d3437d2596ff989dea363c8f3e9 100644 --- a/Mesh/Field.cpp +++ b/Mesh/Field.cpp @@ -27,6 +27,7 @@ #include "BackgroundMeshTools.h" #include "STensor3.h" #include "ExtrudeParams.h" +#include "automaticMeshSizeField.h" #include "nanoflann.hpp" #if defined(HAVE_POST) @@ -2956,6 +2957,7 @@ FieldManager::FieldManager() map_type_name["AttractorAnisoCurve"] = new FieldFactoryT<AttractorAnisoCurveField>(); #endif map_type_name["MaxEigenHessian"] = new FieldFactoryT<MaxEigenHessianField>(); + map_type_name["AutomaticMeshSizeField"] = new FieldFactoryT<automaticMeshSizeField>(); _background_field = -1; } diff --git a/Mesh/automaticMeshSizeField.cpp b/Mesh/automaticMeshSizeField.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ba9b6159b76a77c273df5fc2b66d935d9b95c17f --- /dev/null +++ b/Mesh/automaticMeshSizeField.cpp @@ -0,0 +1,10 @@ +#include "automaticMeshSizeField.h" + + + +double automaticMeshSizeField:: operator()(double X, double Y, double Z, GEntity *ge) { + return _hbulk; +} + +void automaticMeshSizeField:: update(){ +} diff --git a/Mesh/automaticMeshSizeField.h b/Mesh/automaticMeshSizeField.h new file mode 100644 index 0000000000000000000000000000000000000000..7178e9ac1d3832019e81b0026285c39ddfe23875 --- /dev/null +++ b/Mesh/automaticMeshSizeField.h @@ -0,0 +1,52 @@ +#ifndef _AUTOMATIC_MESH_SIZE_FIELD_H_ +#define _AUTOMATIC_MESH_SIZE_FIELD_H_ + +#include "Field.h" + +class automaticMeshSizeField : public Field { + + int _nPointsPerCircle; + int _nPointsPerGap; + double _hmin, _hmax; + double _hbulk; + double _gradientMax; + char fileName[256]; + +public: + automaticMeshSizeField() + { + _nPointsPerCircle = 15; + _nPointsPerGap = 5; + _hmin = 1.e-8;// update needed + _hmax = 1.e+8;// update needed + _hbulk = 0.1; // update needed + _gradientMax =1.4; + + + + options["nPointsPerCircle"] = new FieldOptionInt(_nPointsPerCircle, + "Number of points per circle (adapt to curvature of surfaces)"); + + options["nPointsPerGap"] = new FieldOptionInt(_nPointsPerGap, + "Number of points in thin layers"); + + options["hBulk"] = new FieldOptionDouble(_hbulk, + "Size everywhere no size is prescribed", &update_needed); + + options["gradientMax"] = new FieldOptionDouble(_gradientMax, + "Maximun gradient of the size field"); + + } + const char *getName() { return "AutomaticMeshSizeField"; } + + std::string getDescription(){ + return "Compute a mesh size field that is quite automatic " + "Takes into account surface curvatures and closeness of objects"; + } + + void update(); + virtual double operator()(double X, double Y, double Z, GEntity *ge = 0); +}; + + +#endif