├── .gitignore ├── LICENSE.md ├── MANIFEST.in ├── Makefile ├── README.md ├── bindings ├── PostMeshPy.pxd └── PostMeshPy.pyx ├── docs ├── Car_23s.png ├── F6Iso_2.png ├── almond.png ├── f6BL_58.png ├── inner_surface.png ├── mech2d.png ├── torus.png └── wing2d.png ├── examples ├── Makefile ├── leaf │ ├── Makefile │ ├── leaf.cpp │ ├── leaf.iges │ ├── leaf.py │ ├── leaf_edges.dat │ ├── leaf_elements.dat │ └── leaf_points.dat └── sphere │ ├── Makefile │ ├── nodal_spacing_p4.dat │ ├── sphere.cpp │ ├── sphere.igs │ ├── sphere.py │ ├── sphere_edges.dat │ ├── sphere_elements.dat │ ├── sphere_faces.dat │ └── sphere_points.dat ├── include ├── AuxFuncs.hpp ├── CNPFuncs.hpp ├── EIGEN_INC.hpp ├── OCC_INC.hpp ├── PostMeshBase.hpp ├── PostMeshCurve.hpp ├── PostMeshSurface.hpp ├── PyInterface.hpp ├── PyInterfaceEmulator.hpp └── STL_INC.hpp ├── setup.py └── src ├── PostMeshBase.cpp ├── PostMeshCurve.cpp └── PostMeshSurface.cpp /.gitignore: -------------------------------------------------------------------------------- 1 | # Python bytecodes 2 | *.pyc 3 | *.pyo 4 | 5 | # backup files 6 | *~ 7 | 8 | # dot files 9 | .* 10 | !.gitignore 11 | 12 | # build data 13 | .so 14 | .o 15 | .a 16 | build/ 17 | examples/leaf/leaf 18 | examples/sphere/sphere 19 | 20 | # record files 21 | PostMeshPy.cpp 22 | 23 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Roman Poya 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | global-include *.py *.pyx *.pxd *.cpp *.hpp *.h *.c *.txt *.dat *.rst *.md Makefile -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | CXXFLAGS = -std=c++11 2 | WARNFLAGS = -Wall -Wextra -Wno-unused 3 | OPTFLAGS = -O3 -march=native -mtune=native -mfpmath=sse -ffast-math -DNDEBUG 4 | INCFLAGS = -Iinclude/ -I/usr/local/include/oce -I/usr/local/include/eigen 5 | LIBFLAGS = -L/usr/local/lib 6 | OCELIB = -lTKernel -lTKMath -lTKBRep -lTKIGES -lTKSTEP -lTKG2d -lTKG3d -lTKMeshVS -lTKPrim -lTKGeomBase -lTKGeomAlgo -lTKTopAlgo -lTKShHealing -lTKXSBase 7 | LIBSHAREDFLAGS = -shared -fPIC -pthread 8 | 9 | RM = rm -rf 10 | MKDIR = mkdir 11 | DIRECTORY = build 12 | 13 | SRCS = src/PostMeshBase.cpp src/PostMeshCurve.cpp src/PostMeshSurface.cpp 14 | UNAME_S := $(shell uname -s) 15 | ifeq ($(UNAME_S),Linux) 16 | POSTFIX += libPostMesh.so 17 | endif 18 | ifeq ($(UNAME_S),Darwin) 19 | POSTFIX += libPostMesh.dylib 20 | endif 21 | LIBS = $(POSTFIX) 22 | 23 | .PHONY: all install 24 | 25 | all: $(DIRECTORY) $(LIBS) 26 | 27 | $(DIRECTORY): 28 | @$(MKDIR) $@ 29 | 30 | $(LIBS): $(SRCS) 31 | @echo "Building PostMesh shared library" 32 | $(CXX) $(CXXFLAGS) $(LIBSHAREDFLAGS) $(WARNFLAGS) $(OPTFLAGS) $(INCFLAGS) $(LIBFLAGS) $(OCELIB) $^ -o $(DIRECTORY)/$@ 33 | 34 | INSTALLDIR = /usr/local/lib 35 | 36 | install: $(LIBS) 37 | install -m 0755 $(DIRECTORY)/$(LIBS) $(INSTALLDIR) 38 | 39 | uninstall: 40 | $(RM) $(INSTALLDIR)/$(POSTFIX) 41 | 42 | clean: 43 | $(RM) $(DIRECTORY) -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PostMesh 2 | 3 | 4 | 5 |
6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | **PostMesh** is a solid mechanics based a posteriori high order curvilinear mesh generator based on OpenCascade with C++, Cython and Python APIs. Its main goal is to serve as a bridge between CAD models and high order finite element schemes. Hence, it can be used as a plugin with various compiled and interpreted code-bases. 16 | 17 | ## Philosophy 18 | PostMesh is an a posteriori curvilinear mesh generator, in that it requires a linear mesh in advance. Higher order nodes are then placed on the linear mesh and the projection of these nodes to the exact boundary is computed with the CAD library and subsequently fed as the Dirichlet boundary condition to either a linear, a linearised or a non-linear solid mechanics problem. 19 | 20 | ## Build Requirements 21 | PostMesh depends on the following third party libraries: 22 | 23 | - **[GNU make]** - build process 24 | - **C++11 compatible compiler** - Rvalue references, variadic templates, lambdas etc 25 | - **[OpenCascade]** - CAD processing 26 | - **[Eigen]** - Matrix operations and SIMD vectorisation 27 | - **[Cython]** - Cython bindings 28 | - **[NumPy]** - Python interface 29 | 30 | 31 | [GNU make]: http://www.gnu.org/software/make 32 | [OpenCascade]: http://www.opencascade.com 33 | [Eigen]: http://eigen.tuxfamily.org 34 | [Cython]: http://www.cython.org 35 | [NumPy]: http://www.numpy.org 36 | 37 | Installing these dependencies on unix based systems is straight-forward. For building OpenCascade on Debian based systems, do `apt-get install liboce-*`and on macOS `brew install oce`. Note that, the default location for `Eigen` and `OpenCascade` headers and libraries (under Linux and macOS) are `/usr/local/include/eigen/`, `/usr/local/include/oce/` and `/usr/local/lib`, respectively. 38 | 39 | ## Installation 40 | Both C++ and Python bindings are distributed through this repository. The Python module is available through PyPi 41 | 42 | pip install PostMeshPy 43 | 44 | 45 | To build PostMesh shared library for C++ API, you typically do 46 | 47 | git clone https://github.com/romeric/PostMesh 48 | cd PostMesh 49 | make 50 | [sudo] make install 51 | 52 | To further build the C++ examples, (after building and installing PostMesh shared library) do 53 | 54 | cd examples 55 | make 56 | 57 | 58 | To build Cython/Python bindings manually (make sure you are in PostMesh directory) 59 | 60 | [sudo] python setup.py install 61 | 62 | Or using pip 63 | 64 | python setup.py build_ext 65 | python setup.py bdist_wheel 66 | cd ../ && pip install PostMesh/dist/*.whl 67 | 68 | 69 | ### Usage 70 | PostMesh provides a very intuitive objected oriented API. The interfaces are designed such that C++ and Python codes look and feel the same. Have a look at the examples directory for getting started with PostMesh. For conveninece, here are two complete examples. 71 | 72 | #### A complete C++ example: [3D] surface projections for high order tetrahedral elements 73 | ````c++ 74 | // MAKE AN INSTANCE OF PostMeshSurface 75 | auto curvilinear_mesh = PostMeshSurface(); 76 | // PASS MESH DATA TO PostMesh - PostMesh TAKES RAW POINTERS AS INPUT ARGUMENTS 77 | curvilinear_mesh.SetMeshElements(elements, elements_rows, elements_cols); 78 | curvilinear_mesh.SetMeshPoints(points,points_rows, points_cols); 79 | curvilinear_mesh.SetMeshEdges(edges, edges_rows, edges_cols); 80 | curvilinear_mesh.SetMeshFaces(faces, faces_rows, faces_cols); 81 | curvilinear_mesh.SetScale(scale); 82 | curvilinear_mesh.SetCondition(condition); 83 | curvilinear_mesh.SetProjectionPrecision(precision); 84 | curvilinear_mesh.ComputeProjectionCriteria(); 85 | curvilinear_mesh.ScaleMesh(); 86 | curvilinear_mesh.InferInterpolationPolynomialDegree(); 87 | curvilinear_mesh.SetNodalSpacing(nodal_spacing, nodal_spacing_rows, nodal_spacing_cols); 88 | // READ THE GEOMETRY FROM THE IGES FILE 89 | curvilinear_mesh.ReadIGES(iges_filename); 90 | // EXTRACT GEOMETRY INFORMATION FROM THE IGES FILE 91 | curvilinear_mesh.GetGeomVertices(); 92 | // EXTRACT TRUE BOUNDARY FACES FROM CAD FILE 93 | curvilinear_mesh.GetGeomFaces(); 94 | curvilinear_mesh.GetGeomPointsOnCorrespondingFaces(); 95 | // FIRST IDENTIFY WHICH SURFACES CONTAIN WHICH FACES 96 | curvilinear_mesh.IdentifySurfacesContainingFaces(); 97 | // PROJECT ALL BOUNDARY POINTS FROM THE MESH TO THE SURFACE 98 | curvilinear_mesh.ProjectMeshOnSurface(); 99 | // PERFORM POINT INVERSION FOR THE INTERIOR POINTS (ORTHOGONAL POINT PROJECTION) 100 | // THE INPUT ARGUMENTS SPECIFY PROJECTION ON CURVE INTERSECTIONS 101 | // AND MODIFICATION OF THE LINEAR MESH IF NECESSARY 102 | curvilinear_mesh.MeshPointInversionSurface(1,1); 103 | // OBTAIN MODIFIED MESH POINTS - THIS IS NECESSARY TO ENSURE LINEAR MESH IS ALSO CORRECT 104 | curvilinear_mesh.ReturnModifiedMeshPoints(points); 105 | // OBTAIN DIRICHLET DATA - (THE DISPLACMENT OF BOUNDARY NODES) 106 | DirichletData Dirichlet_data = curvilinear_mesh.GetDirichletData(); 107 | 108 | ```` 109 | 110 | #### A complete Python example: [2D] curve projections for high order triangular elements 111 | Although all C++ methods are also available in Python, there are some convenience functions defined at Python level that can help shorten the script 112 | ````python 113 | # MAKE AN INSTANCE OF PostMeshCurve 114 | curvilinear_mesh = PostMeshCurve("tri",2) 115 | curvilinear_mesh.SetScale(scale) 116 | curvilinear_mesh.SetCondition(condition) 117 | # SET MESH 118 | curvilinear_mesh.SetMesh(elements=elements, points=points, edges=edges, 119 | faces=np.zeros((1,4),dtype=np.uint64),spacing=nodal_spacing,scale_mesh=True) 120 | curvilinear_mesh.SetProjectionPrecision(1.0e-04) 121 | curvilinear_mesh.ComputeProjectionCriteria() 122 | curvilinear_mesh.GetBoundaryPointsOrder() 123 | # SET CAD GEOMETRY 124 | curvilinear_mesh.SetGeometry(cad_filename) 125 | # PERFORM POINT PROJECTION AND POINT INVERSION 126 | curvilinear_mesh.PerformPointProjectionInversionCurve(projection_type="arc_length") 127 | # OBTAIN MODIFIED MESH POINTS - THIS IS NECESSARY TO ENSURE LINEAR MESH IS ALSO CORRECT 128 | curvilinear_mesh.ReturnModifiedMeshPoints(points) 129 | # OBTAIN DIRICHLET DATA - (THE DISPLACMENT OF BOUNDARY NODES) 130 | Dirichlet_nodes, Dirichlet_values = curvilinear_mesh.GetDirichletData() 131 | ```` 132 | 133 | ## Reference/Citation 134 | PostMesh can be cited as 135 | ````latex 136 | @Article{Poya2016, 137 | author="Poya, Roman and Sevilla, Ruben and Gil, Antonio J.", 138 | title="A unified approach for a posteriori high-order curved mesh generation using solid mechanics", 139 | journal="Computational Mechanics", 140 | year="2016", 141 | volume="58", 142 | number="3", 143 | pages="457--490", 144 | doi={10.1007/s00466-016-1302-2}, 145 | url={https://link.springer.com/article/10.1007/s00466-016-1302-2} 146 | } 147 | ```` 148 | 149 | ## Disclaimer 150 | PostMesh does not directly produce curved volume meshes, but only curved surface meshes. As mentioned before, the former step can be achieved by relying on a solid mechanics solver. 151 | -------------------------------------------------------------------------------- /bindings/PostMeshPy.pxd: -------------------------------------------------------------------------------- 1 | from cython import double 2 | from libcpp.vector cimport vector 3 | from libcpp.string cimport string 4 | 5 | 6 | ctypedef long long Integer 7 | ctypedef unsigned long long UInteger 8 | ctypedef double Real 9 | 10 | cdef extern from "PyInterface.hpp": 11 | 12 | struct DirichletData: 13 | vector[Real] displacement_BC_stl 14 | vector[Integer] nodes_dir_out_stl 15 | Integer nodes_dir_size 16 | 17 | 18 | cdef extern from "PostMeshBase.hpp": 19 | 20 | cdef cppclass PostMeshBase: 21 | PostMeshBase() except + 22 | PostMeshBase(string &element_type, const UInteger &dim) except + 23 | UInteger ndim 24 | void Init(string &element_type, const UInteger &dim) except + 25 | void SetScale(const Real &scale) 26 | void SetCondition(const Real &condition) 27 | void SetProjectionPrecision(const Real &precision) 28 | void SetProjectionCriteria(UInteger *criteria, Integer &rows, Integer &cols) 29 | void ComputeProjectionCriteria() 30 | void SetMeshElements(UInteger *arr, const Integer &rows, const Integer &cols) 31 | void SetMeshPoints(Real *arr, Integer &rows, Integer &cols) 32 | void SetMeshEdges(UInteger *arr, const Integer &rows, const Integer &cols) 33 | void SetMeshFaces(UInteger *arr, const Integer &rows, const Integer &cols) 34 | void ScaleMesh() 35 | string GetMeshElementType() 36 | void SetNodalSpacing(Real *arr, const Integer &rows, const Integer &cols) 37 | void ReadIGES(const char* filename) 38 | void ReadSTEP(const char* filename) 39 | void GetGeomVertices() 40 | void GetGeomEdges() 41 | void GetGeomFaces() 42 | vector[Real] ObtainGeomVertices() 43 | Integer NbPoints() 44 | Integer NbCurves() 45 | Integer NbSurfaces() 46 | DirichletData GetDirichletData() 47 | 48 | 49 | cdef extern from "PostMeshCurve.hpp": 50 | 51 | cdef cppclass PostMeshCurve: 52 | PostMeshCurve() except + 53 | PostMeshCurve(string &element_type, const UInteger &dim) except + 54 | void Init() except + 55 | vector[vector[Real]] DiscretiseCurves(Integer npoints) except + 56 | void GetCurvesParameters() 57 | void GetCurvesLengths() 58 | void GetGeomPointsOnCorrespondingEdges() 59 | void IdentifyCurvesContainingEdges() 60 | void ProjectMeshOnCurve() 61 | void RepairDualProjectedParameters() 62 | void MeshPointInversionCurve() 63 | void MeshPointInversionCurveArcLength() 64 | void GetBoundaryPointsOrder() 65 | void ReturnModifiedMeshPoints(Real *points) 66 | 67 | 68 | cdef extern from "PostMeshSurface.hpp": 69 | 70 | cdef cppclass PostMeshSurface: 71 | PostMeshSurface() except + 72 | PostMeshSurface(string &element_type, const UInteger &dim) except + 73 | void Init() except + 74 | void GetSurfacesParameters() 75 | void GetGeomPointsOnCorrespondingFaces() 76 | void IdentifySurfacesContainingFaces(Integer activate_bounding_box, Real bb_tolerance) 77 | void IdentifyRemainingSurfacesByProjection(Integer activate_bounding_box) 78 | void IdentifySurfacesContainingFacesByPureProjection(Integer activate_bounding_box, Real bb_tolerance) 79 | void IdentifySurfacesIntersections() 80 | void SupplySurfacesContainingFaces(const Integer *arr, Integer rows, Integer already_mapped, Integer caller) 81 | void ProjectMeshOnSurface() 82 | void RepairDualProjectedParameters() 83 | void MeshPointInversionSurface(Integer project_on_curves, Integer modify_linear_mesh) 84 | void MeshPointInversionSurfaceArcLength(Integer project_on_curves, Real OrthTol, Real *FEbases, Integer rows, Integer cols) 85 | void ReturnModifiedMeshPoints(Real *points) 86 | vector[vector[Integer]] GetMeshFacesOnPlanarSurfaces() 87 | vector[Integer] GetDirichletFaces() 88 | 89 | 90 | cdef extern from "PyInterfaceEmulator.hpp": 91 | 92 | DirichletData ComputeDirichleteData (const char* iges_filename, Real scale, 93 | Real* points_array, Integer points_rows, Integer points_cols, 94 | UInteger* elements_array, const Integer element_rows, const Integer element_cols, 95 | UInteger* edges, const Integer edges_rows, const Integer edges_cols, 96 | UInteger* faces, const Integer faces_rows, const Integer faces_cols, Real condition, 97 | Real* boundary_fekete, const Integer fekete_rows, const Integer fekete_cols, 98 | UInteger* criteria, const Integer criteria_rows, const Integer criteria_cols, 99 | const Real precision) 100 | 101 | DirichletData ComputeDirichleteData3D (const char* iges_filename, Real scale, 102 | Real* points_array, Integer points_rows, Integer points_cols, 103 | UInteger* elements_array, const Integer element_rows, const Integer element_cols, 104 | UInteger* edges, const Integer edges_rows, const Integer edges_cols, 105 | UInteger* faces, const Integer faces_rows, const Integer faces_cols, Real condition, 106 | Real* boundary_fekete, const Integer fekete_rows, const Integer fekete_cols, 107 | UInteger* criteria, const Integer criteria_rows, const Integer criteria_cols, 108 | const Real precision) -------------------------------------------------------------------------------- /docs/Car_23s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/romeric/PostMesh/d68f44707166d6556042ed79b336c996d8ae52c5/docs/Car_23s.png -------------------------------------------------------------------------------- /docs/F6Iso_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/romeric/PostMesh/d68f44707166d6556042ed79b336c996d8ae52c5/docs/F6Iso_2.png -------------------------------------------------------------------------------- /docs/almond.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/romeric/PostMesh/d68f44707166d6556042ed79b336c996d8ae52c5/docs/almond.png -------------------------------------------------------------------------------- /docs/f6BL_58.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/romeric/PostMesh/d68f44707166d6556042ed79b336c996d8ae52c5/docs/f6BL_58.png -------------------------------------------------------------------------------- /docs/inner_surface.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/romeric/PostMesh/d68f44707166d6556042ed79b336c996d8ae52c5/docs/inner_surface.png -------------------------------------------------------------------------------- /docs/mech2d.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/romeric/PostMesh/d68f44707166d6556042ed79b336c996d8ae52c5/docs/mech2d.png -------------------------------------------------------------------------------- /docs/torus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/romeric/PostMesh/d68f44707166d6556042ed79b336c996d8ae52c5/docs/torus.png -------------------------------------------------------------------------------- /docs/wing2d.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/romeric/PostMesh/d68f44707166d6556042ed79b336c996d8ae52c5/docs/wing2d.png -------------------------------------------------------------------------------- /examples/Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | # Building examples 3 | cd sphere; make 4 | cd leaf; make 5 | 6 | clean: 7 | cd sphere; make clean 8 | cd leaf; make clean -------------------------------------------------------------------------------- /examples/leaf/Makefile: -------------------------------------------------------------------------------- 1 | CXXFLAGS = -std=c++11 2 | WARNFLAGS = -Wall -Wextra -Wno-unused 3 | OPTFLAGS = -O3 -march=native -mtune=native -mfpmath=sse -ffast-math -D_OCC64 -DNDEBUG 4 | INCFLAGS = -I../../include/ -I/usr/local/include/oce -I/usr/local/include/eigen/ 5 | 6 | # For both OCE and PostMesh 7 | LIBDIR = -L/usr/local/lib/ 8 | POSTMESHLIB = -lPostMesh 9 | OCELIBS = -lTKernel -lTKMath -lTKBRep -lTKIGES -lTKSTEP -lTKG2d -lTKG3d -lTKMeshVS -lTKPrim -lTKGeomBase -lTKGeomAlgo -lTKTopAlgo -lTKShHealing -lTKXSBase 10 | 11 | 12 | RM = rm -rf 13 | 14 | EXAMPLE_SRC = leaf.cpp 15 | EXAMPLE = leaf 16 | 17 | 18 | .PHONY: all clean 19 | 20 | all: $(EXAMPLE) 21 | 22 | $(EXAMPLE): $(EXAMPLE_SRC) 23 | @echo "Building leaf example" 24 | $(CXX) $^ -o $@ $(CXXFLAGS) $(WARNFLAGS) $(OPTFLAGS) $(INCFLAGS) $(LIBDIR) $(POSTMESHLIB) $(OCELIBS) 25 | 26 | clean: 27 | $(RM) $(EXAMPLE) -------------------------------------------------------------------------------- /examples/leaf/leaf.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | 5 | int main() 6 | { 7 | // THIS IS AN EXAMPLE OF A 2D LEAF SHAPED GEOMETRY MESHED WITH P=8 8 | // TRIANGULAR FINITE ELEMENTS 9 | 10 | // GET PROBLEM PATH 11 | auto exepath = getexepath(); 12 | auto cpath = exepath.substr(0,exepath.size()-std::string("leaf").size()); 13 | 14 | // READ MESH DATA FROM FILES 15 | std::string elem_file = cpath+"leaf_elements.dat"; 16 | std::string point_file = cpath+"leaf_points.dat"; 17 | std::string edge_file = cpath+"leaf_edges.dat"; 18 | 19 | // PostMesh NEEDS ALL THIS INFORMATION A PRIORI 20 | Eigen::MatrixUI elements = PostMeshBase::ReadI(elem_file,','); 21 | Eigen::MatrixR points = PostMeshBase::ReadR(point_file,','); 22 | Eigen::MatrixUI edges = PostMeshBase::ReadI(edge_file,','); 23 | Eigen::MatrixUI faces = Eigen::MatrixUI::Zero(1,4); 24 | 25 | 26 | // NODAL SPACING OF POINTS IN THE REFRERENCE TRIANGLE (GAUSS-LOBATTO SPACING IN THS CASE) 27 | Eigen::Matrix nodal_spacing; 28 | nodal_spacing << -1.,-0.899758,-0.67718628,-0.36311746,0.,0.36311746,0.67718628,0.899758,1.; 29 | 30 | // CAD FILE TO BE READ 31 | std::string iges_filename = cpath+"leaf.iges"; 32 | 33 | // DOES THE MESH/CAD FILE NEED TO BE SCALED? 34 | // THIS IS IMPORTANT AS MOST CAD LIBRARIES SCALE UP/DOWN 35 | // IMPORTED CADD FILES 36 | Real scale = 1000.; 37 | // THIS CONDITION TELLS PostMesh IF ALL THE BOUNDARY POINTS 38 | // IN THE MESH REQUIRE PROJECTION - ANY BOUNDARY POINT FALLING 39 | // WITHIN THIS RADIUS WOULD BE PROJECTED 40 | Real condition = 1.e10; 41 | // PRECISION TOLERANCE BETWEEN CAD GEOMETRY AND MESH DATA. 42 | // NORMALLY, DUE TO MESH DATA AND CAD GEOMETRY COMING FROM DIFFERENT 43 | // SOURCES, THERE'S AN ARITHMATIC PRECISION ISSUE. THIS PRECISION TELLS 44 | // PostMesh TO TREAT POINTS FROM CAD AND MESH WITHIN THIS PRECISION AS 45 | // ONE POINT 46 | auto precision = 1.0e-07; 47 | 48 | 49 | // MAKE AN INSTANCE OF PostMeshCurve 50 | auto curvilinear_mesh = PostMeshCurve(); 51 | // PASS MESH DATA TO PostMesh - PostMesh takes raw pointers as input arguments 52 | curvilinear_mesh.SetMeshElements(elements.data(), elements.rows(), elements.cols()); 53 | curvilinear_mesh.SetMeshPoints(points.data(),points.rows(), points.cols()); 54 | curvilinear_mesh.SetMeshEdges(edges.data(), edges.rows(), edges.cols()); 55 | curvilinear_mesh.SetMeshFaces(faces.data(), faces.rows(), faces.cols()); 56 | curvilinear_mesh.SetScale(scale); 57 | curvilinear_mesh.SetCondition(condition); 58 | curvilinear_mesh.SetProjectionPrecision(precision); 59 | curvilinear_mesh.ComputeProjectionCriteria(); 60 | curvilinear_mesh.ScaleMesh(); 61 | curvilinear_mesh.InferInterpolationPolynomialDegree(); 62 | curvilinear_mesh.SetNodalSpacing(nodal_spacing.data(), nodal_spacing.rows(), nodal_spacing.cols()); 63 | // GET EDGE NUMBERING ORDER 64 | curvilinear_mesh.GetBoundaryPointsOrder(); 65 | // READ THE GEOMETRY FROM THE IGES FILE 66 | curvilinear_mesh.ReadIGES(iges_filename.c_str()); 67 | // EXTRACT GEOMETRY INFORMATION FROM THE IGES FILE 68 | curvilinear_mesh.GetGeomVertices(); 69 | // FIRST IDENTIFY WHICH CURVES CONTAIN WHICH EDGES 70 | curvilinear_mesh.GetGeomEdges(); 71 | // FIND WHICH POINTS OR ON WHICH EDGE 72 | curvilinear_mesh.GetGeomPointsOnCorrespondingEdges(); 73 | // FIRST IDENTIFY WHICH CURVES CONTAIN WHICH EDGES 74 | curvilinear_mesh.IdentifyCurvesContainingEdges(); 75 | // PROJECT ALL BOUNDARY POINTS FROM THE MESH TO THE CURVE 76 | curvilinear_mesh.ProjectMeshOnCurve(); 77 | // FIX IMAGES AND ANTI IMAGES IN PERIODIC CURVES/SURFACES 78 | curvilinear_mesh.RepairDualProjectedParameters(); 79 | // PERFORM POINT INVERSION FOR THE INTERIOR POINTS (ARC-LENGTH BASED POINT PROJECTION) 80 | curvilinear_mesh.MeshPointInversionCurveArcLength(); 81 | // OBTAIN MODIFIED MESH POINTS - THIS IS NECESSARY TO ENSURE LINEAR MESH IS ALSO CORRECT 82 | curvilinear_mesh.ReturnModifiedMeshPoints(points.data()); 83 | // GET DIRICHLET DATA - (THE DISPLACMENT OF BOUNDARY NODES) 84 | // nodesDBC IS AN ARRAY OF SIZE [NO OF BOUNDARY NODES] CONTAINING 85 | // GLOBAL NODE NUMBERS IN THE ELEMENT CONNECTIVITY AND Dirichlet IS 86 | // THE CORRESPONDING DISPLACEMENT ARRAY [NO OF BOUNDARY NODES x DIMENSIONS] 87 | DirichletData Dirichlet_data = curvilinear_mesh.GetDirichletData(); 88 | 89 | // FINALLY, CHECK DIRICHLET DATA 90 | print("\n"); 91 | auto counter = 1; 92 | for (auto &i: Dirichlet_data.displacement_BC_stl) { 93 | std::cout << i << "\t"; 94 | if (std::remainder(counter,curvilinear_mesh.ndim) == 0) { 95 | print(" "); 96 | } 97 | counter++; 98 | } 99 | print("\n\n"); 100 | 101 | return 0; 102 | } 103 | -------------------------------------------------------------------------------- /examples/leaf/leaf.iges: -------------------------------------------------------------------------------- 1 | S0000001 2 | ,,31HOpen CASCADE IGES processor 6.7,13HFilename.iges, G0000001 3 | 16HOpen CASCADE 6.7,31HOpen CASCADE IGES processor 6.7,32,308,15,308,15,G0000002 4 | ,1.,6,1HM,1,0.00001,15H20150715.200350,1.0001E-07,1.082392,5Hroman,,11, G0000003 5 | 0,15H20150715.200350,; G0000004 6 | 102 1 0 0 0 0 0 000000000D0000001 7 | 102 0 0 1 0 0D0000002 8 | 100 2 0 0 0 0 5 000010000D0000003 9 | 100 0 0 1 0 0D0000004 10 | 124 3 0 0 0 0 0 000000000D0000005 11 | 124 0 0 1 0 0D0000006 12 | 100 4 0 0 0 0 9 000010000D0000007 13 | 100 0 0 1 0 0D0000008 14 | 124 5 0 0 0 0 0 000000000D0000009 15 | 124 0 0 1 0 0D0000010 16 | 102,2,3,7; 0000001P0000001 17 | 100,0.,0.,0.,1.25,-1.110223025E-16,-0.35,1.2; 0000003P0000002 18 | 124,-0.8,0.6,0.,0.,0.6,0.8,0.,-0.75,0.,0.,-1.,0.; 0000005P0000003 19 | 100,0.,0.,0.,1.25,0.,-0.35,1.2; 0000007P0000004 20 | 124,0.8,-0.6,0.,0.,-0.6,-0.8,0.,0.75,0.,0.,-1.,0.; 0000009P0000005 21 | S 1G 4D 10P 5 T0000001 22 | -------------------------------------------------------------------------------- /examples/leaf/leaf.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | from PostMeshPy import PostMeshCurvePy as PostMeshCurve 3 | 4 | 5 | def Leaf(): 6 | 7 | # THIS IS AN EXAMPLE OF A 2D LEAF SHAPED GEOMETRY MESHED WITH P=8 8 | # TRIANGULAR FINITE ELEMENTS - SAME AS THE C++ EXAMPLE 9 | 10 | # READ MESH DATA 11 | elements = np.loadtxt("leaf_elements.dat",delimiter=",").astype(np.uint64) 12 | points = np.loadtxt("leaf_points.dat",delimiter=",",dtype=np.float64) 13 | edges = np.loadtxt("leaf_edges.dat",delimiter=",").astype(np.uint64) 14 | # SUPPLY CAD FILE 15 | iges_filename = "leaf.iges" 16 | 17 | # DOES THE MESH/CAD FILE NEED TO BE SCALED? 18 | # THIS IS IMPORTANT AS MOST CAD LIBRARIES SCALE UP/DOWN 19 | # IMPORTED CADD FILES 20 | scale = 1000.; 21 | # THIS CONDITION TELLS PostMesh IF ALL THE BOUNDARY POINTS 22 | # IN THE MESH REQUIRE PROJECTION - ANY BOUNDARY POINT FALLING 23 | # WITHIN THIS RADIUS WOULD BE PROJECTED 24 | condition = 1.e10; 25 | # PRECISION TOLERANCE BETWEEN CAD GEOMETRY AND MESH DATA. 26 | # NORMALLY, DUE TO MESH DATA AND CAD GEOMETRY COMING FROM DIFFERENT 27 | # SOURCES, THERE'S AN ARITHMATIC PRECISION ISSUE. THIS PRECISION TELLS 28 | # PostMesh TO TREAT POINTS FROM CAD AND MESH WITHIN THIS PRECISION AS 29 | # ONE POINT 30 | precision = 1.0e-07; 31 | # NODAL SPACING OF POINTS IN THE REFRERENCE TRIANGLE (GAUSS-LOBATTO SPACING IN THS CASE) 32 | nodal_spacing = np.array([-1.,-0.899758,-0.67718628, 33 | -0.36311746,0.,0.36311746,0.67718628,0.899758,1.]) 34 | 35 | 36 | curvilinear_mesh = PostMeshCurve("tri",2) 37 | curvilinear_mesh.SetMeshElements(elements) 38 | curvilinear_mesh.SetMeshPoints(points) 39 | curvilinear_mesh.SetMeshEdges(edges) 40 | curvilinear_mesh.SetMeshFaces(np.zeros((1,4),dtype=np.uint64)) 41 | curvilinear_mesh.SetScale(scale) 42 | curvilinear_mesh.SetCondition(condition) 43 | curvilinear_mesh.SetProjectionPrecision(precision) 44 | curvilinear_mesh.ComputeProjectionCriteria() 45 | curvilinear_mesh.ScaleMesh() 46 | curvilinear_mesh.SetNodalSpacing(nodal_spacing.reshape(-1,1)) 47 | curvilinear_mesh.GetBoundaryPointsOrder() 48 | # READ THE GEOMETRY FROM THE IGES FILE 49 | curvilinear_mesh.ReadIGES(iges_filename) 50 | # EXTRACT GEOMETRY INFORMATION FROM THE IGES FILE 51 | geometry_points = curvilinear_mesh.GetGeomVertices() 52 | curvilinear_mesh.GetGeomEdges() 53 | curvilinear_mesh.GetGeomFaces() 54 | curvilinear_mesh.GetGeomPointsOnCorrespondingEdges() 55 | # FIRST IDENTIFY WHICH CURVES CONTAIN WHICH EDGES 56 | curvilinear_mesh.IdentifyCurvesContainingEdges() 57 | # PROJECT ALL BOUNDARY POINTS FROM THE MESH TO THE CURVE 58 | curvilinear_mesh.ProjectMeshOnCurve() 59 | # FIX IMAGES AND ANTI IMAGES IN PERIODIC CURVES/SURFACES 60 | curvilinear_mesh.RepairDualProjectedParameters() 61 | # PERFORM POINT INVERSION FOR THE INTERIOR POINTS 62 | curvilinear_mesh.MeshPointInversionCurveArcLength() 63 | # OBTAIN MODIFIED MESH POINTS - THIS IS NECESSARY TO ENSURE LINEAR MESH IS ALSO CORRECT 64 | curvilinear_mesh.ReturnModifiedMeshPoints(points) 65 | # GET DIRICHLET DATA - (THE DISPLACMENT OF BOUNDARY NODES) 66 | # Dirichlet_nodes IS AN ARRAY OF SIZE [NO OF BOUNDARY NODES] CONTAINING 67 | # GLOBAL NODE NUMBERS IN THE ELEMENT CONNECTIVITY AND Dirichlet_values IS 68 | # THE CORRESPONDING ARRAY OF BOUNDARY DISPLACEMENTS [NO OF BOUNDARY NODES x DIMENSIONS] 69 | Dirichlet_nodes, Dirichlet_values = curvilinear_mesh.GetDirichletData() 70 | 71 | print(Dirichlet_values) 72 | 73 | 74 | 75 | def Leaf_Shorter(): 76 | 77 | # THIS IS AN EXAMPLE OF A 2D LEAF SHAPED GEOMETRY MESHED WITH P=8 78 | # TRIANGULAR FINITE ELEMENTS - SAME AS THE C++ EXAMPLE 79 | 80 | # READ MESH DATA 81 | elements = np.loadtxt("leaf_elements.dat",delimiter=",").astype(np.uint64) 82 | points = np.loadtxt("leaf_points.dat",delimiter=",",dtype=np.float64) 83 | edges = np.loadtxt("leaf_edges.dat",delimiter=",").astype(np.uint64) 84 | # SUPPLY CAD FILE 85 | iges_filename = "leaf.iges" 86 | 87 | # DOES THE MESH/CAD FILE NEED TO BE SCALED? 88 | # THIS IS IMPORTANT AS MOST CAD LIBRARIES SCALE UP/DOWN 89 | # IMPORTED CADD FILES 90 | scale = 1000.; 91 | # THIS CONDITION TELLS PostMesh IF ALL THE POINTS IN THE MESH 92 | # FALL WITHIN CAD GEOMETRY OR IF THERE ARE POINST OUTISDE WHICH 93 | # DO NOT TO BE PROJECTED 94 | condition = 1.e10; 95 | # PRECISION TOLERANCE BETWEEN CAD GEOMETRY AND MESH DATA. 96 | # NORMALLY, DUE TO MESH DATA AND CAD GEOMETRY COMING FROM DIFFERENT 97 | # SOURCES, THERE'S AN ARITHMATIC PRECISION ISSUE. THIS PRECISION TELLS 98 | # PostMesh TO TREAT POINTS FROM CAD AND MESH WITHIN THIS PRECISION AS 99 | # ONE POINT 100 | precision = 1.0e-07; 101 | # NODAL SPACING OF POINTS IN THE REFRERENCE TRIANGLE (GAUSS-LOBATTO SPACING IN THS CASE) 102 | nodal_spacing = np.array([-1.,-0.899758,-0.67718628, 103 | -0.36311746,0.,0.36311746,0.67718628,0.899758,1.]) 104 | 105 | 106 | curvilinear_mesh = PostMeshCurve("tri",2) 107 | 108 | curvilinear_mesh.SetScale(scale) 109 | curvilinear_mesh.SetCondition(condition) 110 | curvilinear_mesh.SetMesh(elements=elements, points=points, edges=edges, 111 | faces=np.zeros((1,4),dtype=np.uint64), spacing=nodal_spacing.reshape(-1,1), 112 | scale_mesh=True) 113 | 114 | curvilinear_mesh.SetProjectionPrecision(precision) 115 | curvilinear_mesh.ComputeProjectionCriteria() 116 | # READ THE GEOMETRY FROM THE IGES FILE 117 | curvilinear_mesh.SetGeometry(iges_filename) 118 | # PERFORM POINT PROJECTION AND POINT INVERSION 119 | curvilinear_mesh.PerformPointProjectionInversionCurve(projection_type="arc_length") 120 | # OBTAIN MODIFIED MESH POINTS - THIS IS NECESSARY TO ENSURE LINEAR MESH IS ALSO CORRECT 121 | curvilinear_mesh.ReturnModifiedMeshPoints(points) 122 | # GET DIRICHLET DATA - (THE DISPLACMENT OF BOUNDARY NODES) 123 | Dirichlet_nodes, Dirichlet_values = curvilinear_mesh.GetDirichletData() 124 | 125 | print(Dirichlet_values) 126 | 127 | 128 | 129 | 130 | if __name__ == "__main__": 131 | Leaf() 132 | Leaf_Shorter() -------------------------------------------------------------------------------- /examples/leaf/leaf_edges.dat: -------------------------------------------------------------------------------- 1 | 0.000000000000000000e+00,2.000000000000000000e+00,3.010000000000000000e+02,3.070000000000000000e+02,3.120000000000000000e+02,3.160000000000000000e+02,3.190000000000000000e+02,3.210000000000000000e+02,3.220000000000000000e+02 2 | 2.000000000000000000e+00,3.000000000000000000e+00,4.620000000000000000e+02,4.680000000000000000e+02,4.730000000000000000e+02,4.770000000000000000e+02,4.800000000000000000e+02,4.820000000000000000e+02,4.830000000000000000e+02 3 | 3.000000000000000000e+00,4.000000000000000000e+00,5.670000000000000000e+02,5.730000000000000000e+02,5.780000000000000000e+02,5.820000000000000000e+02,5.850000000000000000e+02,5.870000000000000000e+02,5.880000000000000000e+02 4 | 4.000000000000000000e+00,5.000000000000000000e+00,4.900000000000000000e+02,4.960000000000000000e+02,5.010000000000000000e+02,5.050000000000000000e+02,5.080000000000000000e+02,5.100000000000000000e+02,5.110000000000000000e+02 5 | 5.000000000000000000e+00,1.000000000000000000e+00,1.060000000000000000e+02,1.140000000000000000e+02,1.210000000000000000e+02,1.270000000000000000e+02,1.320000000000000000e+02,1.360000000000000000e+02,1.390000000000000000e+02 6 | 1.000000000000000000e+00,6.000000000000000000e+00,1.540000000000000000e+02,1.600000000000000000e+02,1.650000000000000000e+02,1.690000000000000000e+02,1.720000000000000000e+02,1.740000000000000000e+02,1.750000000000000000e+02 7 | 6.000000000000000000e+00,7.000000000000000000e+00,5.890000000000000000e+02,5.900000000000000000e+02,5.910000000000000000e+02,5.920000000000000000e+02,5.930000000000000000e+02,5.940000000000000000e+02,5.950000000000000000e+02 8 | 7.000000000000000000e+00,8.000000000000000000e+00,4.280000000000000000e+02,4.290000000000000000e+02,4.300000000000000000e+02,4.310000000000000000e+02,4.320000000000000000e+02,4.330000000000000000e+02,4.340000000000000000e+02 9 | 8.000000000000000000e+00,9.000000000000000000e+00,1.830000000000000000e+02,1.900000000000000000e+02,1.960000000000000000e+02,2.010000000000000000e+02,2.050000000000000000e+02,2.080000000000000000e+02,2.100000000000000000e+02 10 | 9.000000000000000000e+00,0.000000000000000000e+00,2.240000000000000000e+02,2.300000000000000000e+02,2.350000000000000000e+02,2.390000000000000000e+02,2.420000000000000000e+02,2.440000000000000000e+02,2.450000000000000000e+02 11 | -------------------------------------------------------------------------------- /examples/leaf/leaf_elements.dat: -------------------------------------------------------------------------------- 1 | 1.200000000000000000e+01,1.300000000000000000e+01,1.400000000000000000e+01,1.500000000000000000e+01,1.600000000000000000e+01,1.700000000000000000e+01,1.800000000000000000e+01,1.900000000000000000e+01,2.000000000000000000e+01,2.100000000000000000e+01,2.200000000000000000e+01,2.300000000000000000e+01,2.400000000000000000e+01,2.500000000000000000e+01,2.600000000000000000e+01,2.700000000000000000e+01,2.800000000000000000e+01,2.900000000000000000e+01,3.000000000000000000e+01,3.100000000000000000e+01,3.200000000000000000e+01,3.300000000000000000e+01,3.400000000000000000e+01,3.500000000000000000e+01,3.600000000000000000e+01,3.700000000000000000e+01,3.800000000000000000e+01,3.900000000000000000e+01,4.000000000000000000e+01,4.100000000000000000e+01,4.200000000000000000e+01,4.300000000000000000e+01,4.400000000000000000e+01,4.500000000000000000e+01,4.600000000000000000e+01,4.700000000000000000e+01,4.800000000000000000e+01,4.900000000000000000e+01,5.000000000000000000e+01,5.100000000000000000e+01,5.200000000000000000e+01,5.300000000000000000e+01,5.400000000000000000e+01,5.500000000000000000e+01,5.600000000000000000e+01 2 | 1.000000000000000000e+01,9.000000000000000000e+00,1.300000000000000000e+01,5.700000000000000000e+01,5.800000000000000000e+01,5.900000000000000000e+01,6.000000000000000000e+01,6.100000000000000000e+01,6.200000000000000000e+01,6.300000000000000000e+01,6.400000000000000000e+01,6.500000000000000000e+01,6.600000000000000000e+01,6.700000000000000000e+01,6.800000000000000000e+01,6.900000000000000000e+01,7.000000000000000000e+01,7.100000000000000000e+01,7.200000000000000000e+01,7.300000000000000000e+01,7.400000000000000000e+01,7.500000000000000000e+01,7.600000000000000000e+01,7.700000000000000000e+01,7.800000000000000000e+01,7.900000000000000000e+01,8.000000000000000000e+01,8.100000000000000000e+01,8.200000000000000000e+01,8.300000000000000000e+01,8.400000000000000000e+01,8.500000000000000000e+01,8.600000000000000000e+01,8.700000000000000000e+01,8.800000000000000000e+01,8.900000000000000000e+01,9.000000000000000000e+01,9.100000000000000000e+01,9.200000000000000000e+01,9.300000000000000000e+01,9.400000000000000000e+01,9.500000000000000000e+01,9.600000000000000000e+01,9.700000000000000000e+01,9.800000000000000000e+01 3 | 5.000000000000000000e+00,1.100000000000000000e+01,1.000000000000000000e+00,9.900000000000000000e+01,1.000000000000000000e+02,1.010000000000000000e+02,1.020000000000000000e+02,1.030000000000000000e+02,1.040000000000000000e+02,1.050000000000000000e+02,1.060000000000000000e+02,1.070000000000000000e+02,1.080000000000000000e+02,1.090000000000000000e+02,1.100000000000000000e+02,1.110000000000000000e+02,1.120000000000000000e+02,1.130000000000000000e+02,1.140000000000000000e+02,1.150000000000000000e+02,1.160000000000000000e+02,1.170000000000000000e+02,1.180000000000000000e+02,1.190000000000000000e+02,1.200000000000000000e+02,1.210000000000000000e+02,1.220000000000000000e+02,1.230000000000000000e+02,1.240000000000000000e+02,1.250000000000000000e+02,1.260000000000000000e+02,1.270000000000000000e+02,1.280000000000000000e+02,1.290000000000000000e+02,1.300000000000000000e+02,1.310000000000000000e+02,1.320000000000000000e+02,1.330000000000000000e+02,1.340000000000000000e+02,1.350000000000000000e+02,1.360000000000000000e+02,1.370000000000000000e+02,1.380000000000000000e+02,1.390000000000000000e+02,1.400000000000000000e+02 4 | 1.100000000000000000e+01,6.000000000000000000e+00,1.000000000000000000e+00,1.410000000000000000e+02,1.420000000000000000e+02,1.430000000000000000e+02,1.440000000000000000e+02,1.450000000000000000e+02,1.460000000000000000e+02,1.470000000000000000e+02,1.130000000000000000e+02,1.480000000000000000e+02,1.490000000000000000e+02,1.500000000000000000e+02,1.510000000000000000e+02,1.520000000000000000e+02,1.530000000000000000e+02,1.540000000000000000e+02,1.200000000000000000e+02,1.550000000000000000e+02,1.560000000000000000e+02,1.570000000000000000e+02,1.580000000000000000e+02,1.590000000000000000e+02,1.600000000000000000e+02,1.260000000000000000e+02,1.610000000000000000e+02,1.620000000000000000e+02,1.630000000000000000e+02,1.640000000000000000e+02,1.650000000000000000e+02,1.310000000000000000e+02,1.660000000000000000e+02,1.670000000000000000e+02,1.680000000000000000e+02,1.690000000000000000e+02,1.350000000000000000e+02,1.700000000000000000e+02,1.710000000000000000e+02,1.720000000000000000e+02,1.380000000000000000e+02,1.730000000000000000e+02,1.740000000000000000e+02,1.400000000000000000e+02,1.750000000000000000e+02 5 | 8.000000000000000000e+00,1.300000000000000000e+01,9.000000000000000000e+00,1.760000000000000000e+02,1.770000000000000000e+02,1.780000000000000000e+02,1.790000000000000000e+02,1.800000000000000000e+02,1.810000000000000000e+02,1.820000000000000000e+02,1.830000000000000000e+02,1.840000000000000000e+02,1.850000000000000000e+02,1.860000000000000000e+02,1.870000000000000000e+02,1.880000000000000000e+02,1.890000000000000000e+02,9.800000000000000000e+01,1.900000000000000000e+02,1.910000000000000000e+02,1.920000000000000000e+02,1.930000000000000000e+02,1.940000000000000000e+02,1.950000000000000000e+02,9.600000000000000000e+01,1.960000000000000000e+02,1.970000000000000000e+02,1.980000000000000000e+02,1.990000000000000000e+02,2.000000000000000000e+02,9.300000000000000000e+01,2.010000000000000000e+02,2.020000000000000000e+02,2.030000000000000000e+02,2.040000000000000000e+02,8.900000000000000000e+01,2.050000000000000000e+02,2.060000000000000000e+02,2.070000000000000000e+02,8.400000000000000000e+01,2.080000000000000000e+02,2.090000000000000000e+02,7.800000000000000000e+01,2.100000000000000000e+02,7.100000000000000000e+01 6 | 1.000000000000000000e+01,0.000000000000000000e+00,9.000000000000000000e+00,2.110000000000000000e+02,2.120000000000000000e+02,2.130000000000000000e+02,2.140000000000000000e+02,2.150000000000000000e+02,2.160000000000000000e+02,2.170000000000000000e+02,5.700000000000000000e+01,2.180000000000000000e+02,2.190000000000000000e+02,2.200000000000000000e+02,2.210000000000000000e+02,2.220000000000000000e+02,2.230000000000000000e+02,2.240000000000000000e+02,5.800000000000000000e+01,2.250000000000000000e+02,2.260000000000000000e+02,2.270000000000000000e+02,2.280000000000000000e+02,2.290000000000000000e+02,2.300000000000000000e+02,5.900000000000000000e+01,2.310000000000000000e+02,2.320000000000000000e+02,2.330000000000000000e+02,2.340000000000000000e+02,2.350000000000000000e+02,6.000000000000000000e+01,2.360000000000000000e+02,2.370000000000000000e+02,2.380000000000000000e+02,2.390000000000000000e+02,6.100000000000000000e+01,2.400000000000000000e+02,2.410000000000000000e+02,2.420000000000000000e+02,6.200000000000000000e+01,2.430000000000000000e+02,2.440000000000000000e+02,6.300000000000000000e+01,2.450000000000000000e+02 7 | 1.100000000000000000e+01,4.000000000000000000e+00,1.400000000000000000e+01,2.460000000000000000e+02,2.470000000000000000e+02,2.480000000000000000e+02,2.490000000000000000e+02,2.500000000000000000e+02,2.510000000000000000e+02,2.520000000000000000e+02,2.530000000000000000e+02,2.540000000000000000e+02,2.550000000000000000e+02,2.560000000000000000e+02,2.570000000000000000e+02,2.580000000000000000e+02,2.590000000000000000e+02,2.600000000000000000e+02,2.610000000000000000e+02,2.620000000000000000e+02,2.630000000000000000e+02,2.640000000000000000e+02,2.650000000000000000e+02,2.660000000000000000e+02,2.670000000000000000e+02,2.680000000000000000e+02,2.690000000000000000e+02,2.700000000000000000e+02,2.710000000000000000e+02,2.720000000000000000e+02,2.730000000000000000e+02,2.740000000000000000e+02,2.750000000000000000e+02,2.760000000000000000e+02,2.770000000000000000e+02,2.780000000000000000e+02,2.790000000000000000e+02,2.800000000000000000e+02,2.810000000000000000e+02,2.820000000000000000e+02,2.830000000000000000e+02,2.840000000000000000e+02,2.850000000000000000e+02,2.860000000000000000e+02,2.870000000000000000e+02 8 | 1.000000000000000000e+01,2.000000000000000000e+00,0.000000000000000000e+00,2.880000000000000000e+02,2.890000000000000000e+02,2.900000000000000000e+02,2.910000000000000000e+02,2.920000000000000000e+02,2.930000000000000000e+02,2.940000000000000000e+02,2.110000000000000000e+02,2.950000000000000000e+02,2.960000000000000000e+02,2.970000000000000000e+02,2.980000000000000000e+02,2.990000000000000000e+02,3.000000000000000000e+02,3.010000000000000000e+02,2.120000000000000000e+02,3.020000000000000000e+02,3.030000000000000000e+02,3.040000000000000000e+02,3.050000000000000000e+02,3.060000000000000000e+02,3.070000000000000000e+02,2.130000000000000000e+02,3.080000000000000000e+02,3.090000000000000000e+02,3.100000000000000000e+02,3.110000000000000000e+02,3.120000000000000000e+02,2.140000000000000000e+02,3.130000000000000000e+02,3.140000000000000000e+02,3.150000000000000000e+02,3.160000000000000000e+02,2.150000000000000000e+02,3.170000000000000000e+02,3.180000000000000000e+02,3.190000000000000000e+02,2.160000000000000000e+02,3.200000000000000000e+02,3.210000000000000000e+02,2.170000000000000000e+02,3.220000000000000000e+02 9 | 7.000000000000000000e+00,1.400000000000000000e+01,1.300000000000000000e+01,3.230000000000000000e+02,3.240000000000000000e+02,3.250000000000000000e+02,3.260000000000000000e+02,3.270000000000000000e+02,3.280000000000000000e+02,3.290000000000000000e+02,3.300000000000000000e+02,3.310000000000000000e+02,3.320000000000000000e+02,3.330000000000000000e+02,3.340000000000000000e+02,3.350000000000000000e+02,3.360000000000000000e+02,5.600000000000000000e+01,3.370000000000000000e+02,3.380000000000000000e+02,3.390000000000000000e+02,3.400000000000000000e+02,3.410000000000000000e+02,3.420000000000000000e+02,5.400000000000000000e+01,3.430000000000000000e+02,3.440000000000000000e+02,3.450000000000000000e+02,3.460000000000000000e+02,3.470000000000000000e+02,5.100000000000000000e+01,3.480000000000000000e+02,3.490000000000000000e+02,3.500000000000000000e+02,3.510000000000000000e+02,4.700000000000000000e+01,3.520000000000000000e+02,3.530000000000000000e+02,3.540000000000000000e+02,4.200000000000000000e+01,3.550000000000000000e+02,3.560000000000000000e+02,3.600000000000000000e+01,3.570000000000000000e+02,2.900000000000000000e+01 10 | 3.000000000000000000e+00,1.000000000000000000e+01,1.200000000000000000e+01,3.580000000000000000e+02,3.590000000000000000e+02,3.600000000000000000e+02,3.610000000000000000e+02,3.620000000000000000e+02,3.630000000000000000e+02,3.640000000000000000e+02,3.650000000000000000e+02,3.660000000000000000e+02,3.670000000000000000e+02,3.680000000000000000e+02,3.690000000000000000e+02,3.700000000000000000e+02,3.710000000000000000e+02,3.720000000000000000e+02,3.730000000000000000e+02,3.740000000000000000e+02,3.750000000000000000e+02,3.760000000000000000e+02,3.770000000000000000e+02,3.780000000000000000e+02,3.790000000000000000e+02,3.800000000000000000e+02,3.810000000000000000e+02,3.820000000000000000e+02,3.830000000000000000e+02,3.840000000000000000e+02,3.850000000000000000e+02,3.860000000000000000e+02,3.870000000000000000e+02,3.880000000000000000e+02,3.890000000000000000e+02,3.900000000000000000e+02,3.910000000000000000e+02,3.920000000000000000e+02,3.930000000000000000e+02,3.940000000000000000e+02,3.950000000000000000e+02,3.960000000000000000e+02,3.970000000000000000e+02,3.980000000000000000e+02,3.990000000000000000e+02 11 | 1.100000000000000000e+01,1.400000000000000000e+01,6.000000000000000000e+00,2.530000000000000000e+02,2.610000000000000000e+02,2.680000000000000000e+02,2.740000000000000000e+02,2.790000000000000000e+02,2.830000000000000000e+02,2.860000000000000000e+02,1.410000000000000000e+02,4.000000000000000000e+02,4.010000000000000000e+02,4.020000000000000000e+02,4.030000000000000000e+02,4.040000000000000000e+02,4.050000000000000000e+02,4.060000000000000000e+02,1.420000000000000000e+02,4.070000000000000000e+02,4.080000000000000000e+02,4.090000000000000000e+02,4.100000000000000000e+02,4.110000000000000000e+02,4.120000000000000000e+02,1.430000000000000000e+02,4.130000000000000000e+02,4.140000000000000000e+02,4.150000000000000000e+02,4.160000000000000000e+02,4.170000000000000000e+02,1.440000000000000000e+02,4.180000000000000000e+02,4.190000000000000000e+02,4.200000000000000000e+02,4.210000000000000000e+02,1.450000000000000000e+02,4.220000000000000000e+02,4.230000000000000000e+02,4.240000000000000000e+02,1.460000000000000000e+02,4.250000000000000000e+02,4.260000000000000000e+02,1.470000000000000000e+02,4.270000000000000000e+02 12 | 8.000000000000000000e+00,7.000000000000000000e+00,1.300000000000000000e+01,4.280000000000000000e+02,4.290000000000000000e+02,4.300000000000000000e+02,4.310000000000000000e+02,4.320000000000000000e+02,4.330000000000000000e+02,4.340000000000000000e+02,1.760000000000000000e+02,4.350000000000000000e+02,4.360000000000000000e+02,4.370000000000000000e+02,4.380000000000000000e+02,4.390000000000000000e+02,4.400000000000000000e+02,3.300000000000000000e+02,1.770000000000000000e+02,4.410000000000000000e+02,4.420000000000000000e+02,4.430000000000000000e+02,4.440000000000000000e+02,4.450000000000000000e+02,3.370000000000000000e+02,1.780000000000000000e+02,4.460000000000000000e+02,4.470000000000000000e+02,4.480000000000000000e+02,4.490000000000000000e+02,3.430000000000000000e+02,1.790000000000000000e+02,4.500000000000000000e+02,4.510000000000000000e+02,4.520000000000000000e+02,3.480000000000000000e+02,1.800000000000000000e+02,4.530000000000000000e+02,4.540000000000000000e+02,3.520000000000000000e+02,1.810000000000000000e+02,4.550000000000000000e+02,3.550000000000000000e+02,1.820000000000000000e+02,3.570000000000000000e+02 13 | 1.000000000000000000e+01,3.000000000000000000e+00,2.000000000000000000e+00,3.640000000000000000e+02,3.630000000000000000e+02,3.620000000000000000e+02,3.610000000000000000e+02,3.600000000000000000e+02,3.590000000000000000e+02,3.580000000000000000e+02,2.880000000000000000e+02,4.560000000000000000e+02,4.570000000000000000e+02,4.580000000000000000e+02,4.590000000000000000e+02,4.600000000000000000e+02,4.610000000000000000e+02,4.620000000000000000e+02,2.890000000000000000e+02,4.630000000000000000e+02,4.640000000000000000e+02,4.650000000000000000e+02,4.660000000000000000e+02,4.670000000000000000e+02,4.680000000000000000e+02,2.900000000000000000e+02,4.690000000000000000e+02,4.700000000000000000e+02,4.710000000000000000e+02,4.720000000000000000e+02,4.730000000000000000e+02,2.910000000000000000e+02,4.740000000000000000e+02,4.750000000000000000e+02,4.760000000000000000e+02,4.770000000000000000e+02,2.920000000000000000e+02,4.780000000000000000e+02,4.790000000000000000e+02,4.800000000000000000e+02,2.930000000000000000e+02,4.810000000000000000e+02,4.820000000000000000e+02,2.940000000000000000e+02,4.830000000000000000e+02 14 | 1.100000000000000000e+01,5.000000000000000000e+00,4.000000000000000000e+00,1.050000000000000000e+02,1.040000000000000000e+02,1.030000000000000000e+02,1.020000000000000000e+02,1.010000000000000000e+02,1.000000000000000000e+02,9.900000000000000000e+01,2.460000000000000000e+02,4.840000000000000000e+02,4.850000000000000000e+02,4.860000000000000000e+02,4.870000000000000000e+02,4.880000000000000000e+02,4.890000000000000000e+02,4.900000000000000000e+02,2.470000000000000000e+02,4.910000000000000000e+02,4.920000000000000000e+02,4.930000000000000000e+02,4.940000000000000000e+02,4.950000000000000000e+02,4.960000000000000000e+02,2.480000000000000000e+02,4.970000000000000000e+02,4.980000000000000000e+02,4.990000000000000000e+02,5.000000000000000000e+02,5.010000000000000000e+02,2.490000000000000000e+02,5.020000000000000000e+02,5.030000000000000000e+02,5.040000000000000000e+02,5.050000000000000000e+02,2.500000000000000000e+02,5.060000000000000000e+02,5.070000000000000000e+02,5.080000000000000000e+02,2.510000000000000000e+02,5.090000000000000000e+02,5.100000000000000000e+02,2.520000000000000000e+02,5.110000000000000000e+02 15 | 1.300000000000000000e+01,1.200000000000000000e+01,1.000000000000000000e+01,2.100000000000000000e+01,2.000000000000000000e+01,1.900000000000000000e+01,1.800000000000000000e+01,1.700000000000000000e+01,1.600000000000000000e+01,1.500000000000000000e+01,9.700000000000000000e+01,5.120000000000000000e+02,5.130000000000000000e+02,5.140000000000000000e+02,5.150000000000000000e+02,5.160000000000000000e+02,5.170000000000000000e+02,3.990000000000000000e+02,9.400000000000000000e+01,5.180000000000000000e+02,5.190000000000000000e+02,5.200000000000000000e+02,5.210000000000000000e+02,5.220000000000000000e+02,3.970000000000000000e+02,9.000000000000000000e+01,5.230000000000000000e+02,5.240000000000000000e+02,5.250000000000000000e+02,5.260000000000000000e+02,3.940000000000000000e+02,8.500000000000000000e+01,5.270000000000000000e+02,5.280000000000000000e+02,5.290000000000000000e+02,3.900000000000000000e+02,7.900000000000000000e+01,5.300000000000000000e+02,5.310000000000000000e+02,3.850000000000000000e+02,7.200000000000000000e+01,5.320000000000000000e+02,3.790000000000000000e+02,6.400000000000000000e+01,3.720000000000000000e+02 16 | 1.200000000000000000e+01,1.400000000000000000e+01,4.000000000000000000e+00,2.200000000000000000e+01,3.000000000000000000e+01,3.700000000000000000e+01,4.300000000000000000e+01,4.800000000000000000e+01,5.200000000000000000e+01,5.500000000000000000e+01,5.330000000000000000e+02,5.340000000000000000e+02,5.350000000000000000e+02,5.360000000000000000e+02,5.370000000000000000e+02,5.380000000000000000e+02,5.390000000000000000e+02,2.870000000000000000e+02,5.400000000000000000e+02,5.410000000000000000e+02,5.420000000000000000e+02,5.430000000000000000e+02,5.440000000000000000e+02,5.450000000000000000e+02,2.850000000000000000e+02,5.460000000000000000e+02,5.470000000000000000e+02,5.480000000000000000e+02,5.490000000000000000e+02,5.500000000000000000e+02,2.820000000000000000e+02,5.510000000000000000e+02,5.520000000000000000e+02,5.530000000000000000e+02,5.540000000000000000e+02,2.780000000000000000e+02,5.550000000000000000e+02,5.560000000000000000e+02,5.570000000000000000e+02,2.730000000000000000e+02,5.580000000000000000e+02,5.590000000000000000e+02,2.670000000000000000e+02,5.600000000000000000e+02,2.600000000000000000e+02 17 | 1.200000000000000000e+01,4.000000000000000000e+00,3.000000000000000000e+00,5.330000000000000000e+02,5.400000000000000000e+02,5.460000000000000000e+02,5.510000000000000000e+02,5.550000000000000000e+02,5.580000000000000000e+02,5.600000000000000000e+02,3.980000000000000000e+02,5.610000000000000000e+02,5.620000000000000000e+02,5.630000000000000000e+02,5.640000000000000000e+02,5.650000000000000000e+02,5.660000000000000000e+02,5.670000000000000000e+02,3.950000000000000000e+02,5.680000000000000000e+02,5.690000000000000000e+02,5.700000000000000000e+02,5.710000000000000000e+02,5.720000000000000000e+02,5.730000000000000000e+02,3.910000000000000000e+02,5.740000000000000000e+02,5.750000000000000000e+02,5.760000000000000000e+02,5.770000000000000000e+02,5.780000000000000000e+02,3.860000000000000000e+02,5.790000000000000000e+02,5.800000000000000000e+02,5.810000000000000000e+02,5.820000000000000000e+02,3.800000000000000000e+02,5.830000000000000000e+02,5.840000000000000000e+02,5.850000000000000000e+02,3.730000000000000000e+02,5.860000000000000000e+02,5.870000000000000000e+02,3.650000000000000000e+02,5.880000000000000000e+02 18 | 7.000000000000000000e+00,6.000000000000000000e+00,1.400000000000000000e+01,5.890000000000000000e+02,5.900000000000000000e+02,5.910000000000000000e+02,5.920000000000000000e+02,5.930000000000000000e+02,5.940000000000000000e+02,5.950000000000000000e+02,3.230000000000000000e+02,5.960000000000000000e+02,5.970000000000000000e+02,5.980000000000000000e+02,5.990000000000000000e+02,6.000000000000000000e+02,6.010000000000000000e+02,4.270000000000000000e+02,3.240000000000000000e+02,6.020000000000000000e+02,6.030000000000000000e+02,6.040000000000000000e+02,6.050000000000000000e+02,6.060000000000000000e+02,4.260000000000000000e+02,3.250000000000000000e+02,6.070000000000000000e+02,6.080000000000000000e+02,6.090000000000000000e+02,6.100000000000000000e+02,4.240000000000000000e+02,3.260000000000000000e+02,6.110000000000000000e+02,6.120000000000000000e+02,6.130000000000000000e+02,4.210000000000000000e+02,3.270000000000000000e+02,6.140000000000000000e+02,6.150000000000000000e+02,4.170000000000000000e+02,3.280000000000000000e+02,6.160000000000000000e+02,4.120000000000000000e+02,3.290000000000000000e+02,4.060000000000000000e+02 19 | -------------------------------------------------------------------------------- /examples/leaf/leaf_points.dat: -------------------------------------------------------------------------------- 1 | -1.000000000,0.000000000 2 | 1.000000000,0.000000000 3 | -0.660141489,0.311467482 4 | -0.230497205,0.478564625 5 | 0.230497205,0.478564625 6 | 0.660141489,0.311467482 7 | 0.660141489,-0.311467482 8 | 0.230497205,-0.478564625 9 | -0.230497205,-0.478564625 10 | -0.660141489,-0.311467482 11 | -0.474930300,0.072689910 12 | 0.560572200,0.078932610 13 | -0.075048900,0.152086800 14 | -0.169797300,-0.179379100 15 | 0.241973700,-0.051512660 16 | -0.079797785,0.135473397 17 | -0.090341942,0.098585930 18 | -0.105220701,0.046534378 19 | -0.122423100,-0.013646150 20 | -0.139625499,-0.073826678 21 | -0.154504258,-0.125878230 22 | -0.165048415,-0.162765697 23 | -0.059159410,0.141882191 24 | -0.059376505,0.114359723 25 | -0.066531087,0.069312768 26 | -0.079592805,0.012887177 27 | -0.096795204,-0.047293351 28 | -0.115814645,-0.103099841 29 | -0.134082978,-0.146991904 30 | -0.149158925,-0.172970306 31 | -0.023879278,0.119224450 32 | -0.020706798,0.083542494 33 | -0.026044340,0.034121500 34 | -0.039106057,-0.022304090 35 | -0.058125498,-0.078110580 36 | -0.080534513,-0.125757581 37 | -0.103334636,-0.158740579 38 | 0.025904179,0.087252330 39 | 0.030893699,0.047196335 40 | 0.025556158,-0.002224659 41 | 0.010677399,-0.054276211 42 | -0.011731616,-0.101923212 43 | -0.038672421,-0.138661149 44 | 0.083462400,0.050287070 45 | 0.088451921,0.010231075 46 | 0.081297338,-0.034815880 47 | 0.063029005,-0.078707944 48 | 0.036088200,-0.115445880 49 | 0.141020621,0.013321810 50 | 0.144193100,-0.022360146 51 | 0.133648943,-0.059247613 52 | 0.110848821,-0.092230611 53 | 0.190804078,-0.018650310 54 | 0.190586983,-0.046172779 55 | 0.175511036,-0.072151181 56 | 0.226084210,-0.041308051 57 | 0.221335325,-0.057921454 58 | -0.484213271,0.053435556 59 | -0.504824658,0.010684269 60 | -0.533909189,-0.049641663 61 | -0.567535900,-0.119388795 62 | -0.601162611,-0.189135927 63 | -0.630247142,-0.249461859 64 | -0.650858529,-0.292213146 65 | -0.459636728,0.060055959 66 | -0.466474699,0.027830038 67 | -0.485257337,-0.024623394 68 | -0.513361535,-0.090150333 69 | -0.546988245,-0.159897465 70 | -0.581595289,-0.224443590 71 | -0.612508570,-0.275067376 72 | -0.635564957,-0.304847097 73 | -0.425679741,0.032004243 74 | -0.430688962,-0.009923823 75 | -0.448491266,-0.067578263 76 | -0.476595464,-0.133105202 77 | -0.511202508,-0.197651327 78 | -0.547638302,-0.252495306 79 | -0.580996582,-0.290147526 80 | -0.377763361,-0.007579265 81 | -0.381792248,-0.054708338 82 | -0.399594553,-0.112362778 83 | -0.428679084,-0.172688710 84 | -0.465114878,-0.227532689 85 | -0.503995671,-0.269405102 86 | -0.322363800,-0.053344595 87 | -0.326392688,-0.100473668 88 | -0.345175326,-0.152927100 89 | -0.376088606,-0.203550887 90 | -0.414969400,-0.245423300 91 | -0.266964239,-0.099109925 92 | -0.271973461,-0.141037990 93 | -0.292584848,-0.183789277 94 | -0.325943129,-0.221441498 95 | -0.219047859,-0.138693433 96 | -0.225885831,-0.170919353 97 | -0.248942218,-0.200699074 98 | -0.185090872,-0.166745149 99 | -0.194373843,-0.185999503 100 | 0.655150987,0.299812618 101 | 0.644070332,0.273934774 102 | 0.628434526,0.237418795 103 | 0.610356850,0.195200055 104 | 0.592279174,0.152981315 105 | 0.576643368,0.116465336 106 | 0.565562713,0.090587492 107 | 0.677175549,0.295856437 108 | 0.677084120,0.273110279 109 | 0.669667759,0.238936661 110 | 0.655996263,0.197973585 111 | 0.637918588,0.155754845 112 | 0.617876602,0.117983203 113 | 0.598576501,0.089762997 114 | 0.582596762,0.074976428 115 | 0.714996993,0.261194509 116 | 0.718569859,0.230152578 117 | 0.713117808,0.191531862 118 | 0.699446312,0.150568787 119 | 0.679404327,0.112797144 120 | 0.655698046,0.083321275 121 | 0.631498862,0.066192345 122 | 0.768366472,0.212283394 123 | 0.773903648,0.176794366 124 | 0.768451597,0.138173651 125 | 0.752815791,0.101657672 126 | 0.729109511,0.072181803 127 | 0.700504146,0.053797210 128 | 0.830070750,0.155733750 129 | 0.835607926,0.120244722 130 | 0.828191565,0.086071104 131 | 0.808891465,0.057850898 132 | 0.780286100,0.039466305 133 | 0.891775028,0.099184106 134 | 0.895347894,0.068142175 135 | 0.884267239,0.042264330 136 | 0.860068054,0.025135400 137 | 0.945144507,0.050272991 138 | 0.945053078,0.027526834 139 | 0.929073338,0.012740265 140 | 0.982965951,0.015611063 141 | 0.977975438,0.003956182 142 | 0.565562713,0.059365365 143 | 0.576643368,0.015919354 144 | 0.592279174,-0.045386896 145 | 0.610356850,-0.116267445 146 | 0.628434526,-0.187147994 147 | 0.644070332,-0.248454244 148 | 0.655150987,-0.291900255 149 | 0.598576501,0.045840294 150 | 0.617876602,-0.004762814 151 | 0.637918588,-0.069905753 152 | 0.655996263,-0.140786302 153 | 0.669667759,-0.207830162 154 | 0.677084120,-0.261979315 155 | 0.677175549,-0.295856437 156 | 0.655698046,0.029899114 157 | 0.679404327,-0.024540684 158 | 0.699446312,-0.089683623 159 | 0.713117808,-0.156727483 160 | 0.718569859,-0.216614245 161 | 0.714996993,-0.261194509 162 | 0.729109511,0.013667289 163 | 0.752815791,-0.040772508 164 | 0.768451597,-0.102078759 165 | 0.773903648,-0.161965521 166 | 0.768366472,-0.212283394 167 | 0.808891465,-0.000663616 168 | 0.828191565,-0.051266724 169 | 0.835607926,-0.105415877 170 | 0.830070750,-0.155733750 171 | 0.884267239,-0.011157831 172 | 0.895347894,-0.054603842 173 | 0.891775028,-0.099184106 174 | 0.945053078,-0.016395869 175 | 0.945144507,-0.050272991 176 | 0.982965951,-0.015611063 177 | -0.227454860,-0.463569123 178 | -0.220699820,-0.430274008 179 | -0.211167847,-0.383291590 180 | -0.200147250,-0.328971850 181 | -0.189126653,-0.274652110 182 | -0.179594680,-0.227669692 183 | -0.172839640,-0.194374577 184 | -0.252031403,-0.470189526 185 | -0.256511207,-0.445687346 186 | -0.255382390,-0.405281647 187 | -0.248866455,-0.354487474 188 | -0.237845858,-0.300167734 189 | -0.223809223,-0.249659749 190 | -0.208651027,-0.209787915 191 | -0.299844737,-0.451593982 192 | -0.309950765,-0.419981218 193 | -0.311837986,-0.375763763 194 | -0.305322050,-0.324969590 195 | -0.291285416,-0.274461605 196 | -0.271622558,-0.231064205 197 | -0.367313676,-0.425353988 198 | -0.380435741,-0.389929468 199 | -0.382322961,-0.345712014 200 | -0.372790988,-0.298729596 201 | -0.353128130,-0.255332195 202 | -0.445319350,-0.395016050 203 | -0.458441415,-0.359591531 204 | -0.457312598,-0.319185831 205 | -0.442154402,-0.279313998 206 | -0.523325024,-0.364678112 207 | -0.533431052,-0.333065348 208 | -0.526676011,-0.299770233 209 | -0.590793963,-0.338438118 210 | -0.595273766,-0.313935938 211 | -0.638607297,-0.319842574 212 | -0.501247320,0.069046619 213 | -0.559680152,0.060957260 214 | -0.642134161,0.049542443 215 | -0.737465150,0.036344955 216 | -0.832796139,0.023147467 217 | -0.915250148,0.011732650 218 | -0.973682980,0.003643291 219 | -0.525011700,0.040477931 220 | -0.594275973,0.025421871 221 | -0.682536368,0.010272430 222 | -0.777867357,-0.002925058 223 | -0.867391960,-0.012387922 224 | -0.939014529,-0.016836038 225 | -0.982965951,-0.015611063 226 | -0.556454528,-0.009240057 227 | -0.631525187,-0.028030741 228 | -0.719785582,-0.043180181 229 | -0.809310185,-0.052643045 230 | -0.888003347,-0.055139209 231 | -0.945144507,-0.050272991 232 | -0.591345445,-0.073300612 233 | -0.666416104,-0.092091296 234 | -0.748870114,-0.103506113 235 | -0.827563276,-0.106002276 236 | -0.891775028,-0.099184106 237 | -0.624972156,-0.143047744 238 | -0.694236428,-0.158103804 239 | -0.765858997,-0.162551920 240 | -0.830070750,-0.155733750 241 | -0.652792480,-0.209060253 242 | -0.711225312,-0.217149612 243 | -0.768366472,-0.212283394 244 | -0.671045571,-0.262419483 245 | -0.714996993,-0.261194509 246 | -0.677175549,-0.295856437 247 | 0.544028510,0.098962566 248 | 0.507295831,0.143435955 249 | 0.455462698,0.206191928 250 | 0.395534700,0.278748605 251 | 0.335606702,0.351305282 252 | 0.283773569,0.414061255 253 | 0.247040890,0.458534644 254 | 0.544603724,0.072394562 255 | 0.514834694,0.097912774 256 | 0.468210057,0.146491130 257 | 0.411074165,0.211447644 258 | 0.351146166,0.284004321 259 | 0.296520928,0.354360458 260 | 0.254579753,0.413011463 261 | 0.231072414,0.451996596 262 | 0.509148216,0.057877849 263 | 0.469487229,0.087501027 264 | 0.417559832,0.138279924 265 | 0.360423940,0.203236438 266 | 0.305798702,0.273592575 267 | 0.261065420,0.339843744 268 | 0.232349586,0.393006494 269 | 0.459117290,0.037393453 270 | 0.414153542,0.069217172 271 | 0.362226146,0.119996069 272 | 0.310393014,0.182752042 273 | 0.265659732,0.249003212 274 | 0.234151791,0.309766125 275 | 0.401272950,0.013709975 276 | 0.356309203,0.045533695 277 | 0.309684566,0.094112051 278 | 0.267743391,0.152763056 279 | 0.236235450,0.213525970 280 | 0.343428610,-0.009973503 281 | 0.303767623,0.019649676 282 | 0.267034943,0.064123065 283 | 0.238319109,0.117285815 284 | 0.293397684,-0.030457899 285 | 0.263628653,-0.004939687 286 | 0.240121314,0.034045446 287 | 0.257942176,-0.044974612 288 | 0.241398486,-0.024944656 289 | -0.484213271,0.084657682 290 | -0.504824658,0.111230251 291 | -0.533909189,0.148726549 292 | -0.567535900,0.192078705 293 | -0.601162611,0.235430861 294 | -0.630247142,0.272927159 295 | -0.650858529,0.299499728 296 | -0.525011700,0.084400634 297 | -0.556454528,0.113505960 298 | -0.591345445,0.152359987 299 | -0.624972156,0.195712143 300 | -0.652792480,0.237706570 301 | -0.671045571,0.272670111 302 | -0.677175549,0.295856437 303 | -0.594275973,0.078844032 304 | -0.631525187,0.109307087 305 | -0.666416104,0.148161114 306 | -0.694236428,0.190155541 307 | -0.711225312,0.229617211 308 | -0.714996993,0.261194509 309 | -0.682536368,0.068786944 310 | -0.719785582,0.099249999 311 | -0.748870114,0.136746297 312 | -0.765858997,0.176207967 313 | -0.768366472,0.212283394 314 | -0.777867357,0.055589456 315 | -0.809310185,0.084694782 316 | -0.827563276,0.119658323 317 | -0.830070750,0.155733750 318 | -0.867391960,0.041034239 319 | -0.888003347,0.067606808 320 | -0.891775028,0.099184106 321 | -0.939014529,0.027086665 322 | -0.945144507,0.050272991 323 | -0.982965951,0.015611063 324 | 0.231072414,-0.457160329 325 | 0.232349586,-0.409635487 326 | 0.234151791,-0.342573639 327 | 0.236235450,-0.265038630 328 | 0.238319109,-0.187503621 329 | 0.240121314,-0.120441773 330 | 0.241398486,-0.072916931 331 | 0.210434038,-0.463569123 332 | 0.203081920,-0.427358116 333 | 0.198429805,-0.368758504 334 | 0.197053511,-0.295759828 335 | 0.199137170,-0.218224819 336 | 0.204399328,-0.146626638 337 | 0.212130820,-0.090639560 338 | 0.165886922,-0.430274008 339 | 0.152605516,-0.382988231 340 | 0.144774902,-0.318451792 341 | 0.143398608,-0.245453116 342 | 0.148660767,-0.173854934 343 | 0.159852212,-0.113331523 344 | 0.103026912,-0.383291590 345 | 0.086567007,-0.330068985 346 | 0.078736393,-0.265532546 347 | 0.080538599,-0.198470698 348 | 0.091730043,-0.137947287 349 | 0.030349950,-0.328971850 350 | 0.013890045,-0.275749245 351 | 0.009237931,-0.217149634 352 | 0.016969423,-0.161162555 353 | -0.042327012,-0.274652110 354 | -0.055608417,-0.227366333 355 | -0.054331245,-0.179841491 356 | -0.105187022,-0.227669692 357 | -0.112539140,-0.191458685 358 | -0.149734138,-0.194374577 359 | -0.242748432,0.458221754 360 | -0.269950379,0.413053641 361 | -0.308334786,0.349317349 362 | -0.352713750,0.275627255 363 | -0.397092714,0.201937161 364 | -0.435477121,0.138200869 365 | -0.462679068,0.093032756 366 | -0.222705975,0.462201205 367 | -0.236771455,0.426926948 368 | -0.265330377,0.370590813 369 | -0.304442215,0.300867705 370 | -0.348821179,0.227177611 371 | -0.392472712,0.159474333 372 | -0.429500144,0.106906063 373 | -0.454887843,0.076669362 374 | -0.205406778,0.425868843 375 | -0.220829233,0.379426564 376 | -0.250115586,0.317103613 377 | -0.289227424,0.247380505 378 | -0.332878957,0.179677227 379 | -0.375173514,0.123141971 380 | -0.410386699,0.085505113 381 | -0.180996046,0.374600595 382 | -0.197145932,0.322171500 383 | -0.226432285,0.259848548 384 | -0.264816692,0.196112257 385 | -0.307111250,0.139577001 386 | -0.347591560,0.097973156 387 | -0.152773050,0.315325700 388 | -0.168922935,0.262896604 389 | -0.197481858,0.206560470 390 | -0.234509290,0.153992200 391 | -0.274989600,0.112388355 392 | -0.124550054,0.256050805 393 | -0.139972508,0.209608525 394 | -0.167174456,0.164440412 395 | -0.202387640,0.126803554 396 | -0.100139322,0.204782557 397 | -0.114204801,0.169508299 398 | -0.139592501,0.139271597 399 | -0.082840125,0.168450195 400 | -0.095091357,0.148107348 401 | 0.545128607,0.042208173 402 | 0.506333010,0.019748819 403 | 0.454511569,-0.004993370 404 | 0.396667230,-0.028676848 405 | 0.340613404,-0.048102532 406 | 0.293922567,-0.060644288 407 | 0.262932689,-0.064541857 408 | 0.552869173,-0.009180478 409 | 0.512283062,-0.035897626 410 | 0.460461620,-0.060639815 411 | 0.404407795,-0.080065499 412 | 0.351694059,-0.091548543 413 | 0.309468852,-0.093471155 414 | 0.566714464,-0.074744522 415 | 0.526128353,-0.101461670 416 | 0.476097426,-0.121946065 417 | 0.423383691,-0.133429109 418 | 0.375135585,-0.134293009 419 | 0.584792140,-0.145625071 420 | 0.545996543,-0.168084425 421 | 0.499305706,-0.180626180 422 | 0.451057600,-0.181490080 423 | 0.604660330,-0.212247826 424 | 0.569204823,-0.226764540 425 | 0.526979615,-0.228687151 426 | 0.623636226,-0.265611436 427 | 0.592646348,-0.269509005 428 | 0.639182511,-0.298438303 429 | -0.207391699,-0.478564600 430 | -0.156089541,-0.478564600 431 | -0.083697559,-0.478564600 432 | 0.000000000,-0.478564600 433 | 0.083697559,-0.478564600 434 | 0.156089541,-0.478564600 435 | 0.207391699,-0.478564600 436 | -0.193712907,-0.457469244 437 | -0.134455163,-0.452906809 438 | -0.057798447,-0.450461035 439 | 0.025899111,-0.450461035 440 | 0.105331937,-0.452906809 441 | 0.169768333,-0.457469244 442 | -0.179002280,-0.419611694 443 | -0.115479804,-0.412603486 444 | -0.038823088,-0.410157712 445 | 0.040609738,-0.412603486 446 | 0.112086977,-0.419611694 447 | -0.165205574,-0.370183502 448 | -0.101683097,-0.363175294 449 | -0.029291115,-0.363175294 450 | 0.042186125,-0.370183502 451 | -0.154184977,-0.315863762 452 | -0.094927234,-0.311301328 453 | -0.030490837,-0.315863762 454 | -0.147429114,-0.263989796 455 | -0.096126956,-0.263989796 456 | -0.145852727,-0.221569813 457 | -0.470754606,0.118143883 458 | -0.442649553,0.173142632 459 | -0.403781021,0.242148810 460 | -0.359402057,0.315838904 461 | -0.315507219,0.384259111 462 | -0.278025917,0.438164767 463 | -0.252031403,0.470189526 464 | -0.490462888,0.154547088 465 | -0.461873710,0.214815723 466 | -0.423005177,0.283821902 467 | -0.379110339,0.352242109 468 | -0.336118606,0.410831680 469 | -0.299844737,0.451593982 470 | -0.519063293,0.197313272 471 | -0.490474115,0.257581908 472 | -0.452089708,0.321318200 473 | -0.409097975,0.379907771 474 | -0.367313676,0.425353988 475 | -0.552690004,0.240665429 476 | -0.524584951,0.295664177 477 | -0.487103650,0.349569833 478 | -0.445319350,0.395016050 479 | -0.586800840,0.278747698 480 | -0.559598893,0.323915811 481 | -0.523325024,0.364678112 482 | -0.616788477,0.306413360 483 | -0.590793963,0.338438118 484 | -0.638607297,0.319842574 485 | 0.544319407,0.123506246 486 | 0.551884962,0.159024330 487 | 0.565636436,0.200708131 488 | 0.583714112,0.242926871 489 | 0.603676120,0.279977789 490 | 0.622827026,0.306853528 491 | 0.638607297,0.319842574 492 | 0.504071627,0.177619875 493 | 0.509752850,0.218305780 494 | 0.523504323,0.259989581 495 | 0.543466331,0.297040499 496 | 0.566943440,0.324451178 497 | 0.590793963,0.338438118 498 | 0.450354163,0.245543669 499 | 0.456035385,0.286229575 500 | 0.471671191,0.322745554 501 | 0.495148300,0.350156232 502 | 0.523325024,0.364678112 503 | 0.390426164,0.318100347 504 | 0.397991719,0.353618431 505 | 0.417142626,0.380494170 506 | 0.445319350,0.395016050 507 | 0.332382498,0.385489202 508 | 0.343463153,0.411367047 509 | 0.367313676,0.425353988 510 | 0.284064467,0.438604936 511 | 0.299844737,0.451593982 512 | 0.252031403,0.470189526 513 | -0.184631368,-0.138234469 514 | -0.177295475,-0.092448377 515 | -0.164136563,-0.035626559 516 | -0.146934163,0.024553969 517 | -0.128011917,0.079964231 518 | -0.109924895,0.123117157 519 | -0.221796619,-0.101284128 520 | -0.216180573,-0.050727769 521 | -0.203021660,0.006094049 522 | -0.184099414,0.061504311 523 | -0.161968905,0.108015947 524 | -0.271432846,-0.056930354 525 | -0.265816799,-0.006373995 526 | -0.250938040,0.045677556 527 | -0.228807531,0.092189193 528 | -0.326832407,-0.011165024 529 | -0.319496513,0.034621068 530 | -0.301409491,0.077773994 531 | -0.380512120,0.029830039 532 | -0.369967963,0.066717507 533 | -0.425220237,0.060514922 534 | -0.059734623,0.168450195 535 | -0.031152025,0.160750864 536 | 0.013621979,0.139966959 537 | 0.068494794,0.108999341 538 | 0.126053016,0.072034081 539 | 0.178521878,0.034064319 540 | 0.218811463,0.000218363 541 | -0.025731663,0.204782557 542 | 0.012344807,0.198957062 543 | 0.062208170,0.179177659 544 | 0.117080985,0.148210041 545 | 0.169549847,0.110240279 546 | 0.212524838,0.070396681 547 | 0.022249588,0.256050805 548 | 0.065415417,0.251229812 549 | 0.115278779,0.231450410 550 | 0.165062236,0.199478289 551 | 0.208037226,0.159634691 552 | 0.077724150,0.315325700 553 | 0.120889979,0.310504708 554 | 0.165663983,0.289720802 555 | 0.205953568,0.255874846 556 | 0.133198712,0.374600595 557 | 0.171275183,0.368775100 558 | 0.206555315,0.346117360 559 | 0.181179963,0.425868843 560 | 0.209762562,0.418169513 561 | 0.215182923,0.462201205 562 | -0.064465611,0.198126234 563 | -0.028173732,0.244415853 564 | 0.021034534,0.301021866 565 | 0.076509097,0.360296762 566 | 0.130756644,0.414233892 567 | 0.176448975,0.455544883 568 | 0.207391699,0.478564600 569 | -0.079475890,0.244415853 570 | -0.041956995,0.296043238 571 | 0.007251271,0.352649251 572 | 0.061498818,0.406586381 573 | 0.113457446,0.450566254 574 | 0.156089541,0.478564600 575 | -0.102659606,0.301021866 576 | -0.065140711,0.352649251 577 | -0.017159460,0.403917499 578 | 0.034799168,0.447897372 579 | 0.083697559,0.478564600 580 | -0.130882602,0.360296762 581 | -0.094590723,0.406586381 582 | -0.048898391,0.447897372 583 | 0.000000000,0.478564600 584 | -0.160332614,0.414233892 585 | -0.126329654,0.450566254 586 | -0.083697559,0.478564600 587 | -0.187032264,0.455544883 588 | -0.156089541,0.478564600 589 | -0.207391699,0.478564600 590 | 0.252031403,-0.470189526 591 | 0.299844737,-0.451593982 592 | 0.367313676,-0.425353988 593 | 0.445319350,-0.395016050 594 | 0.523325024,-0.364678112 595 | 0.590793963,-0.338438118 596 | 0.638607297,-0.319842574 597 | 0.261600313,-0.436671575 598 | 0.316140527,-0.409015545 599 | 0.387215528,-0.377918516 600 | 0.465221202,-0.347580578 601 | 0.539620814,-0.322099675 602 | 0.600362873,-0.304920167 603 | 0.269604364,-0.380086247 604 | 0.327750641,-0.347573183 605 | 0.398825642,-0.316476154 606 | 0.473225254,-0.290995251 607 | 0.540897986,-0.274574834 608 | 0.275012633,-0.308167364 609 | 0.333158910,-0.275654300 610 | 0.400627848,-0.249414306 611 | 0.468300580,-0.232993888 612 | 0.277096292,-0.230632356 613 | 0.331636505,-0.202976326 614 | 0.392378565,-0.185796817 615 | 0.275573887,-0.157954381 616 | 0.323387222,-0.139358837 617 | 0.270649214,-0.099953019 618 | -------------------------------------------------------------------------------- /examples/sphere/Makefile: -------------------------------------------------------------------------------- 1 | CXXFLAGS = -std=c++11 2 | WARNFLAGS = -Wall -Wextra -Wno-unused 3 | OPTFLAGS = -O3 -march=native -mtune=native -mfpmath=sse -ffast-math -D_OCC64 -DNDEBUG 4 | INCFLAGS = -I../../include/ -I/usr/local/include/oce -I/usr/local/include/eigen/ 5 | 6 | # For both OCE and PostMesh 7 | LIBDIR = -L/usr/local/lib/ 8 | POSTMESHLIB = -lPostMesh 9 | OCELIBS = -lTKernel -lTKMath -lTKBRep -lTKIGES -lTKSTEP -lTKG2d -lTKG3d -lTKMeshVS -lTKPrim -lTKGeomBase -lTKGeomAlgo -lTKTopAlgo -lTKShHealing -lTKXSBase 10 | 11 | 12 | RM = rm -f 13 | 14 | EXAMPLE_SRC = sphere.cpp 15 | EXAMPLE = sphere 16 | 17 | 18 | .PHONY: all clean 19 | 20 | all: $(EXAMPLE) 21 | 22 | $(EXAMPLE): $(EXAMPLE_SRC) 23 | @echo "Building sphere example" 24 | $(CXX) $^ -o $@ $(CXXFLAGS) $(WARNFLAGS) $(OPTFLAGS) $(INCFLAGS) $(LIBDIR) $(POSTMESHLIB) $(OCELIBS) 25 | 26 | clean: 27 | $(RM) $(EXAMPLE) -------------------------------------------------------------------------------- /examples/sphere/nodal_spacing_p4.dat: -------------------------------------------------------------------------------- 1 | -1.000000000,-1.000000000 2 | 1.000000000,-1.000000000 3 | -1.000000000,1.000000000 4 | -0.654653671,-1.000000000 5 | 0.000000000,-1.000000000 6 | 0.654653671,-1.000000000 7 | -1.000000000,-0.654653671 8 | -0.551551224,-0.551551224 9 | 0.103102447,-0.551551224 10 | 0.654653671,-0.654653671 11 | -1.000000000,0.000000000 12 | -0.551551224,0.103102447 13 | 0.000000000,0.000000000 14 | -1.000000000,0.654653671 15 | -0.654653671,0.654653671 16 | -------------------------------------------------------------------------------- /examples/sphere/sphere.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | 5 | int main() 6 | { 7 | // THIS IS AN EXAMPLE OF A SPHERE MESH WITH QUARTIC (P=4) 8 | // TETRAHEDRAL FINITE ELEMENTS 9 | 10 | // GET PROBLEM PATH 11 | auto exepath = getexepath(); 12 | auto cpath = exepath.substr(0,exepath.size()-std::string("sphere").size()); 13 | 14 | // READ MESH DATA FROM FILES 15 | std::string elem_file = cpath+"sphere_elements.dat"; 16 | std::string point_file = cpath+"sphere_points.dat"; 17 | std::string edge_file = cpath+"sphere_edges.dat"; 18 | std::string face_file = cpath+"sphere_faces.dat"; 19 | 20 | // PostMesh NEEDS ALL THIS INFORMATION A PRIORI 21 | Eigen::MatrixUI elements = PostMeshBase::ReadI(elem_file,','); 22 | Eigen::MatrixR points = PostMeshBase::ReadR(point_file,','); 23 | Eigen::MatrixUI edges = PostMeshBase::ReadI(edge_file,','); 24 | Eigen::MatrixUI faces = PostMeshBase::ReadI(face_file,','); 25 | 26 | // NODAL SPACING OF POINTS IN THE REFRERENCE TRIANGLE (FEKETE POINT SPACING IN THS CASE) 27 | std::string spacing_file = cpath+"nodal_spacing_p4.dat"; 28 | Eigen::MatrixR nodal_spacing = PostMeshBase::ReadR(spacing_file,','); 29 | 30 | // SUPPLY CAD FILE 31 | std::string iges_filename = cpath+"sphere.igs"; 32 | 33 | // DOES THE MESH/CAD FILE NEED TO BE SCALED? 34 | // THIS IS IMPORTANT AS MOST CAD LIBRARIES SCALE UP/DOWN 35 | // IMPORTED CADD FILES 36 | Real scale = 1000.; 37 | // THIS CONDITION TELLS PostMesh IF ALL THE BOUNDARY POINTS 38 | // IN THE MESH REQUIRE PROJECTION - ANY BOUNDARY POINT FALLING 39 | // WITHIN THIS RADIUS WOULD BE PROJECTED 40 | Real radius = 1.0e10; 41 | // PRECISION TOLERANCE BETWEEN CAD GEOMETRY AND MESH DATA. 42 | // NORMALLY, DUE TO MESH DATA AND CAD GEOMETRY COMING FROM DIFFERENT 43 | // SOURCES, THERE'S AN ARITHMATIC PRECISION ISSUE. THIS PRECISION TELLS 44 | // PostMesh TO TREAT POINTS FROM CAD AND MESH WITHIN THIS PRECISION AS 45 | // ONE POINT 46 | auto precision = 1.0e-07; 47 | 48 | 49 | // MAKE AN INSTANCE OF PostMeshSurface 50 | auto curvilinear_mesh = PostMeshSurface(); 51 | // PASS MESH DATA TO PostMesh - PostMesh TAKES RAW BUFFERS/POINTERS AS INPUT ARGUMENTS 52 | curvilinear_mesh.SetMeshElements(elements.data(), elements.rows(), elements.cols()); 53 | curvilinear_mesh.SetMeshPoints(points.data(),points.rows(), points.cols()); 54 | curvilinear_mesh.SetMeshEdges(edges.data(), edges.rows(), edges.cols()); 55 | curvilinear_mesh.SetMeshFaces(faces.data(), faces.rows(), faces.cols()); 56 | curvilinear_mesh.SetScale(scale); 57 | curvilinear_mesh.SetCondition(radius); 58 | curvilinear_mesh.SetProjectionPrecision(precision); 59 | curvilinear_mesh.ComputeProjectionCriteria(); 60 | curvilinear_mesh.ScaleMesh(); 61 | curvilinear_mesh.InferInterpolationPolynomialDegree(); 62 | curvilinear_mesh.SetNodalSpacing(nodal_spacing.data(), nodal_spacing.rows(), nodal_spacing.cols()); 63 | // READ THE GEOMETRY FROM THE IGES FILE 64 | curvilinear_mesh.ReadIGES(iges_filename.c_str()); 65 | // EXTRACT GEOMETRY INFORMATION FROM THE IGES FILE 66 | curvilinear_mesh.GetGeomVertices(); 67 | // EXTRACT TRUE BOUNDARY FACES FROM CAD FILE 68 | curvilinear_mesh.GetGeomFaces(); 69 | curvilinear_mesh.GetGeomPointsOnCorrespondingFaces(); 70 | // FIRST IDENTIFY WHICH SURFACES CONTAIN WHICH FACES 71 | curvilinear_mesh.IdentifySurfacesContainingFaces(); 72 | // PROJECT ALL BOUNDARY POINTS FROM THE MESH TO THE SURFACE 73 | curvilinear_mesh.ProjectMeshOnSurface(); 74 | // PERFORM POINT INVERSION FOR THE INTERIOR POINTS (ORTHOGONAL PROJECTION) 75 | // THE TWO ARGUMENTS ARE FOR ALLOWING PROJECTION ON CURVE INTERSECTION AND 76 | // MODIFYING THE LINEAR MESH IF IT DOES NOT MATCH WITH THE GEOMETRICAL 77 | // POINTS IN THE CAD FILE (WITHIN THE SPECFIED PRECISION) 78 | curvilinear_mesh.MeshPointInversionSurface(static_cast(0),static_cast(1)); 79 | // OBTAIN MODIFIED MESH POINTS - THIS IS NECESSARY TO ENSURE LINEAR MESH IS ALSO CORRECT 80 | curvilinear_mesh.ReturnModifiedMeshPoints(points.data()); 81 | // GET DIRICHLET DATA - (THE DISPLACMENT OF BOUNDARY NODES) 82 | // nodesDBC IS AN ARRAY OF SIZE [NO OF BOUNDARY NODES] CONTAINING 83 | // GLOBAL NODE NUMBERS IN THE ELEMENT CONNECTIVITY AND Dirichlet IS 84 | // THE CORRESPONDING DISPLACEMENT ARRAY [NO OF BOUNDARY NODES x DIMENSION] 85 | DirichletData Dirichlet_data = curvilinear_mesh.GetDirichletData(); 86 | 87 | 88 | // FINALLY, CHECK DIRICHLET DATA 89 | print("\n"); 90 | auto counter = 1; 91 | for (auto &i: Dirichlet_data.displacement_BC_stl) { 92 | std::cout << i << "\t"; 93 | if (std::remainder(counter,curvilinear_mesh.ndim) == 0) { 94 | print(" "); 95 | } 96 | counter++; 97 | } 98 | print("\n\n"); 99 | 100 | return 0; 101 | } 102 | -------------------------------------------------------------------------------- /examples/sphere/sphere.igs: -------------------------------------------------------------------------------- 1 | S0000001 2 | ,,31HOpen CASCADE IGES processor 6.7,13HFilename.iges, G0000001 3 | 16HOpen CASCADE 6.7,31HOpen CASCADE IGES processor 6.7,32,308,15,308,15,G0000002 4 | ,1.,6,1HM,1,0.00001,15H20150628.043945,1E-07,1.007104,5Hroman,,11,0, G0000003 5 | 15H20150628.043945,; G0000004 6 | 186 1 0 0 0 0 0 000000000D0000001 7 | 186 0 0 1 0 0D0000002 8 | 514 2 0 0 0 0 0 000010000D0000003 9 | 514 0 0 1 1 0D0000004 10 | 510 3 0 0 0 0 0 000010000D0000005 11 | 510 0 0 1 1 0D0000006 12 | 196 4 0 0 0 0 0 000010000D0000007 13 | 196 0 0 1 1 0D0000008 14 | 116 5 0 0 0 0 0 000010400D0000009 15 | 116 0 0 1 0 0D0000010 16 | 123 6 0 0 0 0 0 000010200D0000011 17 | 123 0 0 1 0 0D0000012 18 | 123 7 0 0 0 0 0 000010200D0000013 19 | 123 0 0 1 0 0D0000014 20 | 508 8 0 0 0 0 0 000010000D0000015 21 | 508 0 0 2 1 0D0000016 22 | 502 10 0 0 0 0 0 000010000D0000017 23 | 502 0 0 2 1 0D0000018 24 | 110 12 0 0 0 0 0 000010000D0000019 25 | 110 0 0 1 0 0D0000020 26 | 504 13 0 0 0 0 0 000010001D0000021 27 | 504 0 0 1 1 0D0000022 28 | 100 14 0 0 0 0 25 000010000D0000023 29 | 100 0 0 1 0 0D0000024 30 | 124 15 0 0 0 0 0 000000000D0000025 31 | 124 0 0 2 0 0D0000026 32 | 110 17 0 0 0 0 0 000010000D0000027 33 | 110 0 0 1 0 0D0000028 34 | 110 18 0 0 0 0 0 000010000D0000029 35 | 110 0 0 1 0 0D0000030 36 | 110 19 0 0 0 0 0 000010000D0000031 37 | 110 0 0 1 0 0D0000032 38 | 186,3,1,0; 0000001P0000001 39 | 514,1,5,1; 0000003P0000002 40 | 510,7,1,1,15; 0000005P0000003 41 | 196,9,1.,11,13; 0000007P0000004 42 | 116,0.,0.,0.,0; 0000009P0000005 43 | 123,0.,0.,1.; 0000011P0000006 44 | 123,1.,0.,-0.; 0000013P0000007 45 | 508,4,1,17,1,0,1,0,19,0,21,1,0,1,0,27,1,17,2,1,1,0,29,0,21,1,1, 0000015P0000008 46 | 1,0,31; 0000015P0000009 47 | 502,2,6.123233996E-17,-1.499759783E-32,1.,6.123233996E-17, 0000017P0000010 48 | -1.499759783E-32,-1.; 0000017P0000011 49 | 110,360.,90.,0.,0.,90.,0.; 0000019P0000012 50 | 504,1,23,17,2,17,1; 0000021P0000013 51 | 100,0.,0.,0.,-1.836970199E-16,-1.,3.061616998E-16,1.; 0000023P0000014 52 | 124,1.,0.,-2.449293598E-16,0.,-2.449293598E-16,0.,-1.,0.,0.,1., 0000025P0000015 53 | 0.,0.; 0000025P0000016 54 | 110,0.,90.,-0.,0.,-90.,-0.; 0000027P0000017 55 | 110,0.,-90.,0.,360.,-90.,0.; 0000029P0000018 56 | 110,360.,-90.,0.,360.,90.,0.; 0000031P0000019 57 | S 1G 4D 32P 19 T0000001 58 | -------------------------------------------------------------------------------- /examples/sphere/sphere.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | from PostMeshPy import PostMeshSurfacePy as PostMeshSurface 3 | 4 | 5 | def Sphere(): 6 | 7 | # THIS IS AN EXAMPLE OF A SPHERE MESH WITH QUARTIC (P=4) 8 | # TETRAHEDRAL FINITE ELEMENTS - SAME AS THE C++ EXAMPLE 9 | 10 | # READ MESH DATA 11 | elements = np.loadtxt("sphere_elements.dat",delimiter=",").astype(np.uint64) 12 | points = np.loadtxt("sphere_points.dat",delimiter=",",dtype=np.float64) 13 | edges = np.loadtxt("sphere_edges.dat",delimiter=",").astype(np.uint64) 14 | faces = np.loadtxt("sphere_faces.dat",delimiter=",").astype(np.uint64) 15 | # SUPPLY CAD FILE 16 | iges_filename = "sphere.igs" 17 | 18 | # DOES THE MESH/CAD FILE NEED TO BE SCALED? 19 | # THIS IS IMPORTANT AS MOST CAD LIBRARIES SCALE UP/DOWN 20 | # IMPORTED CADD FILES 21 | scale = 1000.; 22 | # THIS CONDITION TELLS PostMesh IF ALL THE BOUNDARY POINTS 23 | # IN THE MESH REQUIRE PROJECTION - ANY BOUNDARY POINT FALLING 24 | # WITHIN THIS RADIUS WOULD BE PROJECTED 25 | radius = 1.e10; 26 | # PRECISION TOLERANCE BETWEEN CAD GEOMETRY AND MESH DATA. 27 | # NORMALLY, DUE TO MESH DATA AND CAD GEOMETRY COMING FROM DIFFERENT 28 | # SOURCES, THERE'S AN ARITHMATIC PRECISION ISSUE. THIS PRECISION TELLS 29 | # PostMesh TO TREAT POINTS FROM CAD AND MESH WITHIN THIS PRECISION AS 30 | # ONE POINT 31 | precision = 1.0e-07; 32 | # NODAL SPACING OF POINTS IN THE REFRERENCE TRIANGLE (GAUSS-LOBATTO SPACING IN THS CASE) 33 | nodal_spacing = np.loadtxt("nodal_spacing_p4.dat",delimiter=",",dtype=np.float64) 34 | 35 | curvilinear_mesh = PostMeshSurface("tet",3) 36 | curvilinear_mesh.SetMeshElements(elements) 37 | curvilinear_mesh.SetMeshPoints(points) 38 | curvilinear_mesh.SetMeshEdges(edges) 39 | curvilinear_mesh.SetMeshFaces(faces) 40 | curvilinear_mesh.SetScale(scale) 41 | curvilinear_mesh.SetCondition(radius) 42 | curvilinear_mesh.SetProjectionPrecision(precision) 43 | curvilinear_mesh.ComputeProjectionCriteria() 44 | curvilinear_mesh.ScaleMesh() 45 | curvilinear_mesh.SetNodalSpacing(nodal_spacing) 46 | # READ THE GEOMETRY FROM THE IGES FILE 47 | curvilinear_mesh.ReadIGES(iges_filename) 48 | # EXTRACT GEOMETRY INFORMATION FROM THE IGES FILE 49 | geometry_points = curvilinear_mesh.GetGeomVertices() 50 | # curvilinear_mesh.GetGeomEdges() 51 | curvilinear_mesh.GetGeomFaces() 52 | curvilinear_mesh.GetGeomPointsOnCorrespondingFaces() 53 | # FIRST IDENTIFY WHICH SURFACES CONTAIN WHICH FACES 54 | curvilinear_mesh.IdentifySurfacesContainingFaces() 55 | # PROJECT ALL BOUNDARY POINTS FROM THE MESH TO THE CURVE 56 | curvilinear_mesh.ProjectMeshOnSurface() 57 | # PERFORM POINT INVERSION FOR THE INTERIOR POINTS 58 | # PERFORM POINT INVERSION FOR THE INTERIOR POINTS (ORTHOGONAL PROJECTION) 59 | # THE TWO ARGUMENTS ARE FOR ALLOWING PROJECTION ON CURVE INTERSECTION AND 60 | # MODIFYING THE LINEAR MESH IF IT DOES NOT MATCH WITH THE GEOMETRICAL 61 | # POINTS IN THE CAD FILE (WITHIN THE SPECFIED PRECISION) 62 | curvilinear_mesh.MeshPointInversionSurface(project_on_curves=0,modify_linear_mesh=1) 63 | # OBTAIN MODIFIED MESH POINTS - THIS IS NECESSARY TO ENSURE LINEAR MESH IS ALSO CORRECT 64 | curvilinear_mesh.ReturnModifiedMeshPoints(points) 65 | # GET DIRICHLET DATA - (THE DISPLACMENT OF BOUNDARY NODES) 66 | # nodesDBC IS AN ARRAY OF SIZE [NO OF BOUNDARY NODES] CONTAINING 67 | # GLOBAL NODE NUMBERS IN THE ELEMENT CONNECTIVITY AND Dirichlet IS 68 | # THE CORRESPONDING DISPLACEMENT ARRAY [NO OF BOUNDARY NODES x DIMENSION] 69 | nodesDBC, Dirichlet = curvilinear_mesh.GetDirichletData() 70 | 71 | print(Dirichlet) 72 | 73 | 74 | if __name__ == "__main__": 75 | Sphere() -------------------------------------------------------------------------------- /examples/sphere/sphere_edges.dat: -------------------------------------------------------------------------------- 1 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 2 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 3 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 4 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 5 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 6 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 7 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 8 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 9 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 10 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 11 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 12 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 13 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 14 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 15 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 16 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 17 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 18 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 19 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 20 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 21 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 22 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 23 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 24 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 25 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 26 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 27 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 28 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 29 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 30 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 31 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 32 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 33 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 34 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 35 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 36 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 37 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 38 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 39 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 40 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 41 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 42 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 43 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 44 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 45 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 46 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 47 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 48 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 49 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 50 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 51 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 52 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 53 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 54 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 55 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 56 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 57 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 58 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 59 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 60 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 61 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 62 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 63 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 64 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 65 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 66 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 67 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 68 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 69 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 70 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 71 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 72 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 73 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 74 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 75 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 76 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 77 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 78 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 79 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 80 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 81 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 82 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 83 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 84 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 85 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 86 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 87 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 88 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 89 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 90 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 91 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 92 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 93 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 94 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 95 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 96 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 97 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 98 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 99 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 100 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 101 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 102 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 103 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 104 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 105 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 106 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 107 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 108 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 109 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 110 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 111 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 112 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 113 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 114 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 115 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 116 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 117 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 118 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 119 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 120 | 0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00 121 | -------------------------------------------------------------------------------- /examples/sphere/sphere_faces.dat: -------------------------------------------------------------------------------- 1 | 3.600000000000000000e+01,3.700000000000000000e+01,4.100000000000000000e+01,4.300000000000000000e+01,4.400000000000000000e+01,4.500000000000000000e+01,4.600000000000000000e+01,4.700000000000000000e+01,4.800000000000000000e+01,4.900000000000000000e+01,5.000000000000000000e+01,5.100000000000000000e+01,5.200000000000000000e+01,5.300000000000000000e+01,5.400000000000000000e+01 2 | 3.500000000000000000e+01,3.600000000000000000e+01,4.100000000000000000e+01,7.400000000000000000e+01,7.500000000000000000e+01,7.600000000000000000e+01,7.700000000000000000e+01,7.800000000000000000e+01,7.900000000000000000e+01,4.600000000000000000e+01,8.000000000000000000e+01,8.100000000000000000e+01,5.000000000000000000e+01,8.200000000000000000e+01,5.300000000000000000e+01 3 | 3.300000000000000000e+01,2.300000000000000000e+01,3.400000000000000000e+01,9.300000000000000000e+01,9.400000000000000000e+01,9.500000000000000000e+01,9.600000000000000000e+01,9.700000000000000000e+01,9.800000000000000000e+01,9.900000000000000000e+01,1.000000000000000000e+02,1.010000000000000000e+02,1.020000000000000000e+02,1.030000000000000000e+02,1.040000000000000000e+02 4 | 2.500000000000000000e+01,3.400000000000000000e+01,2.400000000000000000e+01,1.240000000000000000e+02,1.250000000000000000e+02,1.260000000000000000e+02,1.270000000000000000e+02,1.280000000000000000e+02,1.290000000000000000e+02,1.300000000000000000e+02,1.310000000000000000e+02,1.320000000000000000e+02,1.330000000000000000e+02,1.340000000000000000e+02,1.350000000000000000e+02 5 | 3.400000000000000000e+01,3.500000000000000000e+01,4.100000000000000000e+01,1.520000000000000000e+02,1.530000000000000000e+02,1.540000000000000000e+02,1.550000000000000000e+02,1.560000000000000000e+02,1.570000000000000000e+02,7.700000000000000000e+01,1.580000000000000000e+02,1.590000000000000000e+02,8.000000000000000000e+01,1.600000000000000000e+02,8.200000000000000000e+01 6 | 3.400000000000000000e+01,2.500000000000000000e+01,3.500000000000000000e+01,1.260000000000000000e+02,1.250000000000000000e+02,1.240000000000000000e+02,1.520000000000000000e+02,1.680000000000000000e+02,1.690000000000000000e+02,1.700000000000000000e+02,1.530000000000000000e+02,1.710000000000000000e+02,1.720000000000000000e+02,1.540000000000000000e+02,1.730000000000000000e+02 7 | 7.000000000000000000e+00,6.000000000000000000e+00,0.000000000000000000e+00,1.780000000000000000e+02,1.790000000000000000e+02,1.800000000000000000e+02,1.810000000000000000e+02,1.820000000000000000e+02,1.830000000000000000e+02,1.840000000000000000e+02,1.850000000000000000e+02,1.860000000000000000e+02,1.870000000000000000e+02,1.880000000000000000e+02,1.890000000000000000e+02 8 | 2.500000000000000000e+01,3.600000000000000000e+01,3.500000000000000000e+01,2.090000000000000000e+02,2.100000000000000000e+02,2.110000000000000000e+02,1.700000000000000000e+02,2.120000000000000000e+02,2.130000000000000000e+02,7.600000000000000000e+01,1.720000000000000000e+02,2.140000000000000000e+02,7.500000000000000000e+01,1.730000000000000000e+02,7.400000000000000000e+01 9 | 4.100000000000000000e+01,3.800000000000000000e+01,3.900000000000000000e+01,2.190000000000000000e+02,2.200000000000000000e+02,2.210000000000000000e+02,2.220000000000000000e+02,2.230000000000000000e+02,2.240000000000000000e+02,2.250000000000000000e+02,2.260000000000000000e+02,2.270000000000000000e+02,2.280000000000000000e+02,2.290000000000000000e+02,2.300000000000000000e+02 10 | 7.000000000000000000e+00,1.600000000000000000e+01,6.000000000000000000e+00,2.470000000000000000e+02,2.480000000000000000e+02,2.490000000000000000e+02,1.780000000000000000e+02,2.500000000000000000e+02,2.510000000000000000e+02,2.520000000000000000e+02,1.790000000000000000e+02,2.530000000000000000e+02,2.540000000000000000e+02,1.800000000000000000e+02,2.550000000000000000e+02 11 | 4.000000000000000000e+00,1.300000000000000000e+01,3.000000000000000000e+00,2.660000000000000000e+02,2.670000000000000000e+02,2.680000000000000000e+02,2.690000000000000000e+02,2.700000000000000000e+02,2.710000000000000000e+02,2.720000000000000000e+02,2.730000000000000000e+02,2.740000000000000000e+02,2.750000000000000000e+02,2.760000000000000000e+02,2.770000000000000000e+02 12 | 5.000000000000000000e+00,4.000000000000000000e+00,0.000000000000000000e+00,2.970000000000000000e+02,2.980000000000000000e+02,2.990000000000000000e+02,3.000000000000000000e+02,3.010000000000000000e+02,3.020000000000000000e+02,3.030000000000000000e+02,3.040000000000000000e+02,3.050000000000000000e+02,3.060000000000000000e+02,3.070000000000000000e+02,3.080000000000000000e+02 13 | 3.600000000000000000e+01,2.700000000000000000e+01,3.700000000000000000e+01,3.220000000000000000e+02,3.230000000000000000e+02,3.240000000000000000e+02,4.300000000000000000e+01,3.250000000000000000e+02,3.260000000000000000e+02,3.270000000000000000e+02,4.400000000000000000e+01,3.280000000000000000e+02,3.290000000000000000e+02,4.500000000000000000e+01,3.300000000000000000e+02 14 | 4.000000000000000000e+00,3.000000000000000000e+00,0.000000000000000000e+00,2.690000000000000000e+02,2.730000000000000000e+02,2.760000000000000000e+02,3.030000000000000000e+02,3.410000000000000000e+02,3.420000000000000000e+02,3.430000000000000000e+02,3.060000000000000000e+02,3.440000000000000000e+02,3.450000000000000000e+02,3.080000000000000000e+02,3.460000000000000000e+02 15 | 4.000000000000000000e+01,4.100000000000000000e+01,3.900000000000000000e+01,3.510000000000000000e+02,3.520000000000000000e+02,3.530000000000000000e+02,3.540000000000000000e+02,3.550000000000000000e+02,3.560000000000000000e+02,2.220000000000000000e+02,3.570000000000000000e+02,3.580000000000000000e+02,2.260000000000000000e+02,3.590000000000000000e+02,2.290000000000000000e+02 16 | 1.600000000000000000e+01,7.000000000000000000e+00,1.700000000000000000e+01,2.490000000000000000e+02,2.480000000000000000e+02,2.470000000000000000e+02,3.700000000000000000e+02,3.710000000000000000e+02,3.720000000000000000e+02,3.730000000000000000e+02,3.740000000000000000e+02,3.750000000000000000e+02,3.760000000000000000e+02,3.770000000000000000e+02,3.780000000000000000e+02 17 | 2.600000000000000000e+01,3.600000000000000000e+01,2.500000000000000000e+01,3.890000000000000000e+02,3.900000000000000000e+02,3.910000000000000000e+02,3.920000000000000000e+02,3.930000000000000000e+02,3.940000000000000000e+02,2.110000000000000000e+02,3.950000000000000000e+02,3.960000000000000000e+02,2.100000000000000000e+02,3.970000000000000000e+02,2.090000000000000000e+02 18 | 1.800000000000000000e+01,1.700000000000000000e+01,7.000000000000000000e+00,4.080000000000000000e+02,4.090000000000000000e+02,4.100000000000000000e+02,4.110000000000000000e+02,4.120000000000000000e+02,4.130000000000000000e+02,3.780000000000000000e+02,4.140000000000000000e+02,4.150000000000000000e+02,3.760000000000000000e+02,4.160000000000000000e+02,3.730000000000000000e+02 19 | 1.300000000000000000e+01,4.000000000000000000e+00,1.400000000000000000e+01,2.680000000000000000e+02,2.670000000000000000e+02,2.660000000000000000e+02,4.270000000000000000e+02,4.280000000000000000e+02,4.290000000000000000e+02,4.300000000000000000e+02,4.310000000000000000e+02,4.320000000000000000e+02,4.330000000000000000e+02,4.340000000000000000e+02,4.350000000000000000e+02 20 | 1.400000000000000000e+01,2.500000000000000000e+01,2.400000000000000000e+01,4.460000000000000000e+02,4.470000000000000000e+02,4.480000000000000000e+02,4.490000000000000000e+02,4.500000000000000000e+02,4.510000000000000000e+02,1.270000000000000000e+02,4.520000000000000000e+02,4.530000000000000000e+02,1.310000000000000000e+02,4.540000000000000000e+02,1.340000000000000000e+02 21 | 3.000000000000000000e+00,2.000000000000000000e+00,0.000000000000000000e+00,4.620000000000000000e+02,4.630000000000000000e+02,4.640000000000000000e+02,3.430000000000000000e+02,4.650000000000000000e+02,4.660000000000000000e+02,4.670000000000000000e+02,3.450000000000000000e+02,4.680000000000000000e+02,4.690000000000000000e+02,3.460000000000000000e+02,4.700000000000000000e+02 22 | 1.400000000000000000e+01,5.000000000000000000e+00,1.500000000000000000e+01,4.810000000000000000e+02,4.820000000000000000e+02,4.830000000000000000e+02,4.840000000000000000e+02,4.850000000000000000e+02,4.860000000000000000e+02,4.870000000000000000e+02,4.880000000000000000e+02,4.890000000000000000e+02,4.900000000000000000e+02,4.910000000000000000e+02,4.920000000000000000e+02 23 | 1.600000000000000000e+01,2.500000000000000000e+01,1.500000000000000000e+01,5.060000000000000000e+02,5.070000000000000000e+02,5.080000000000000000e+02,5.090000000000000000e+02,5.100000000000000000e+02,5.110000000000000000e+02,5.120000000000000000e+02,5.130000000000000000e+02,5.140000000000000000e+02,5.150000000000000000e+02,5.160000000000000000e+02,5.170000000000000000e+02 24 | 4.100000000000000000e+01,4.000000000000000000e+01,3.100000000000000000e+01,3.530000000000000000e+02,3.520000000000000000e+02,3.510000000000000000e+02,5.280000000000000000e+02,5.290000000000000000e+02,5.300000000000000000e+02,5.310000000000000000e+02,5.320000000000000000e+02,5.330000000000000000e+02,5.340000000000000000e+02,5.350000000000000000e+02,5.360000000000000000e+02 25 | 3.000000000000000000e+00,1.300000000000000000e+01,2.000000000000000000e+00,2.770000000000000000e+02,2.750000000000000000e+02,2.720000000000000000e+02,4.620000000000000000e+02,5.470000000000000000e+02,5.480000000000000000e+02,5.490000000000000000e+02,4.630000000000000000e+02,5.500000000000000000e+02,5.510000000000000000e+02,4.640000000000000000e+02,5.520000000000000000e+02 26 | 3.200000000000000000e+01,2.300000000000000000e+01,3.300000000000000000e+01,5.570000000000000000e+02,5.580000000000000000e+02,5.590000000000000000e+02,5.600000000000000000e+02,5.610000000000000000e+02,5.620000000000000000e+02,9.500000000000000000e+01,5.630000000000000000e+02,5.640000000000000000e+02,9.400000000000000000e+01,5.650000000000000000e+02,9.300000000000000000e+01 27 | 1.400000000000000000e+01,1.500000000000000000e+01,2.500000000000000000e+01,4.840000000000000000e+02,4.880000000000000000e+02,4.910000000000000000e+02,4.460000000000000000e+02,5.760000000000000000e+02,5.770000000000000000e+02,5.170000000000000000e+02,4.470000000000000000e+02,5.780000000000000000e+02,5.150000000000000000e+02,4.480000000000000000e+02,5.120000000000000000e+02 28 | 3.200000000000000000e+01,4.100000000000000000e+01,3.100000000000000000e+01,5.800000000000000000e+02,5.810000000000000000e+02,5.820000000000000000e+02,5.830000000000000000e+02,5.840000000000000000e+02,5.850000000000000000e+02,5.280000000000000000e+02,5.860000000000000000e+02,5.870000000000000000e+02,5.320000000000000000e+02,5.880000000000000000e+02,5.350000000000000000e+02 29 | 2.800000000000000000e+01,3.700000000000000000e+01,2.700000000000000000e+01,5.960000000000000000e+02,5.970000000000000000e+02,5.980000000000000000e+02,5.990000000000000000e+02,6.000000000000000000e+02,6.010000000000000000e+02,3.300000000000000000e+02,6.020000000000000000e+02,6.030000000000000000e+02,3.290000000000000000e+02,6.040000000000000000e+02,3.270000000000000000e+02 30 | 2.700000000000000000e+01,1.800000000000000000e+01,2.800000000000000000e+01,6.150000000000000000e+02,6.160000000000000000e+02,6.170000000000000000e+02,6.040000000000000000e+02,6.180000000000000000e+02,6.190000000000000000e+02,6.200000000000000000e+02,6.020000000000000000e+02,6.210000000000000000e+02,6.220000000000000000e+02,5.990000000000000000e+02,6.230000000000000000e+02 31 | 3.700000000000000000e+01,2.800000000000000000e+01,3.800000000000000000e+01,5.980000000000000000e+02,5.970000000000000000e+02,5.960000000000000000e+02,6.310000000000000000e+02,6.320000000000000000e+02,6.330000000000000000e+02,6.340000000000000000e+02,6.350000000000000000e+02,6.360000000000000000e+02,6.370000000000000000e+02,6.380000000000000000e+02,6.390000000000000000e+02 32 | 2.300000000000000000e+01,3.200000000000000000e+01,2.200000000000000000e+01,5.590000000000000000e+02,5.580000000000000000e+02,5.570000000000000000e+02,6.470000000000000000e+02,6.480000000000000000e+02,6.490000000000000000e+02,6.500000000000000000e+02,6.510000000000000000e+02,6.520000000000000000e+02,6.530000000000000000e+02,6.540000000000000000e+02,6.550000000000000000e+02 33 | 2.500000000000000000e+01,1.600000000000000000e+01,2.600000000000000000e+01,5.080000000000000000e+02,5.070000000000000000e+02,5.060000000000000000e+02,3.970000000000000000e+02,6.660000000000000000e+02,6.670000000000000000e+02,6.680000000000000000e+02,3.950000000000000000e+02,6.690000000000000000e+02,6.700000000000000000e+02,3.920000000000000000e+02,6.710000000000000000e+02 34 | 3.800000000000000000e+01,2.800000000000000000e+01,3.900000000000000000e+01,6.390000000000000000e+02,6.370000000000000000e+02,6.340000000000000000e+02,2.250000000000000000e+02,6.760000000000000000e+02,6.770000000000000000e+02,6.780000000000000000e+02,2.280000000000000000e+02,6.790000000000000000e+02,6.800000000000000000e+02,2.300000000000000000e+02,6.810000000000000000e+02 35 | 6.000000000000000000e+00,5.000000000000000000e+00,0.000000000000000000e+00,6.860000000000000000e+02,6.870000000000000000e+02,6.880000000000000000e+02,1.840000000000000000e+02,6.890000000000000000e+02,6.900000000000000000e+02,3.000000000000000000e+02,1.870000000000000000e+02,6.910000000000000000e+02,3.040000000000000000e+02,1.890000000000000000e+02,3.070000000000000000e+02 36 | 1.800000000000000000e+01,9.000000000000000000e+00,1.900000000000000000e+01,6.960000000000000000e+02,6.970000000000000000e+02,6.980000000000000000e+02,6.990000000000000000e+02,7.000000000000000000e+02,7.010000000000000000e+02,7.020000000000000000e+02,7.030000000000000000e+02,7.040000000000000000e+02,7.050000000000000000e+02,7.060000000000000000e+02,7.070000000000000000e+02 37 | 3.700000000000000000e+01,3.800000000000000000e+01,4.100000000000000000e+01,6.310000000000000000e+02,6.350000000000000000e+02,6.380000000000000000e+02,4.900000000000000000e+01,7.240000000000000000e+02,7.250000000000000000e+02,2.210000000000000000e+02,5.200000000000000000e+01,7.260000000000000000e+02,2.200000000000000000e+02,5.400000000000000000e+01,2.190000000000000000e+02 38 | 5.000000000000000000e+00,1.400000000000000000e+01,4.000000000000000000e+00,4.830000000000000000e+02,4.820000000000000000e+02,4.810000000000000000e+02,2.970000000000000000e+02,7.280000000000000000e+02,7.290000000000000000e+02,4.350000000000000000e+02,2.980000000000000000e+02,7.300000000000000000e+02,4.330000000000000000e+02,2.990000000000000000e+02,4.300000000000000000e+02 39 | 1.600000000000000000e+01,1.500000000000000000e+01,5.000000000000000000e+00,5.090000000000000000e+02,5.130000000000000000e+02,5.160000000000000000e+02,7.320000000000000000e+02,7.330000000000000000e+02,7.340000000000000000e+02,4.920000000000000000e+02,7.350000000000000000e+02,7.360000000000000000e+02,4.900000000000000000e+02,7.370000000000000000e+02,4.870000000000000000e+02 40 | 2.300000000000000000e+01,1.400000000000000000e+01,2.400000000000000000e+01,7.420000000000000000e+02,7.430000000000000000e+02,7.440000000000000000e+02,7.450000000000000000e+02,7.460000000000000000e+02,7.470000000000000000e+02,4.490000000000000000e+02,7.480000000000000000e+02,7.490000000000000000e+02,4.520000000000000000e+02,7.500000000000000000e+02,4.540000000000000000e+02 41 | 2.800000000000000000e+01,1.900000000000000000e+01,2.900000000000000000e+01,7.580000000000000000e+02,7.590000000000000000e+02,7.600000000000000000e+02,7.610000000000000000e+02,7.620000000000000000e+02,7.630000000000000000e+02,7.640000000000000000e+02,7.650000000000000000e+02,7.660000000000000000e+02,7.670000000000000000e+02,7.680000000000000000e+02,7.690000000000000000e+02 42 | 2.900000000000000000e+01,3.900000000000000000e+01,2.800000000000000000e+01,7.830000000000000000e+02,7.840000000000000000e+02,7.850000000000000000e+02,7.680000000000000000e+02,7.860000000000000000e+02,7.870000000000000000e+02,6.810000000000000000e+02,7.650000000000000000e+02,7.880000000000000000e+02,6.800000000000000000e+02,7.610000000000000000e+02,6.780000000000000000e+02 43 | 2.800000000000000000e+01,1.900000000000000000e+01,1.800000000000000000e+01,7.580000000000000000e+02,7.590000000000000000e+02,7.600000000000000000e+02,6.230000000000000000e+02,7.930000000000000000e+02,7.940000000000000000e+02,7.060000000000000000e+02,6.220000000000000000e+02,7.960000000000000000e+02,7.030000000000000000e+02,6.200000000000000000e+02,6.990000000000000000e+02 44 | 3.000000000000000000e+01,2.900000000000000000e+01,1.900000000000000000e+01,7.970000000000000000e+02,7.980000000000000000e+02,7.990000000000000000e+02,8.000000000000000000e+02,8.010000000000000000e+02,8.020000000000000000e+02,7.690000000000000000e+02,8.030000000000000000e+02,8.040000000000000000e+02,7.670000000000000000e+02,8.050000000000000000e+02,7.640000000000000000e+02 45 | 3.900000000000000000e+01,3.000000000000000000e+01,4.000000000000000000e+01,8.160000000000000000e+02,8.170000000000000000e+02,8.180000000000000000e+02,3.590000000000000000e+02,8.190000000000000000e+02,8.200000000000000000e+02,8.210000000000000000e+02,3.570000000000000000e+02,8.220000000000000000e+02,8.230000000000000000e+02,3.540000000000000000e+02,8.240000000000000000e+02 46 | 3.000000000000000000e+01,3.900000000000000000e+01,2.900000000000000000e+01,8.180000000000000000e+02,8.170000000000000000e+02,8.160000000000000000e+02,7.970000000000000000e+02,8.320000000000000000e+02,8.330000000000000000e+02,7.850000000000000000e+02,7.980000000000000000e+02,8.340000000000000000e+02,7.840000000000000000e+02,7.990000000000000000e+02,7.830000000000000000e+02 47 | 1.800000000000000000e+01,2.700000000000000000e+01,1.700000000000000000e+01,6.170000000000000000e+02,6.160000000000000000e+02,6.150000000000000000e+02,4.080000000000000000e+02,8.360000000000000000e+02,8.370000000000000000e+02,8.380000000000000000e+02,4.090000000000000000e+02,8.390000000000000000e+02,8.400000000000000000e+02,4.100000000000000000e+02,8.410000000000000000e+02 48 | 2.100000000000000000e+01,4.000000000000000000e+01,3.100000000000000000e+01,8.460000000000000000e+02,8.470000000000000000e+02,8.480000000000000000e+02,8.550000000000000000e+02,8.560000000000000000e+02,8.570000000000000000e+02,5.310000000000000000e+02,8.610000000000000000e+02,8.620000000000000000e+02,5.340000000000000000e+02,8.640000000000000000e+02,5.360000000000000000e+02 49 | 2.400000000000000000e+01,3.400000000000000000e+01,2.300000000000000000e+01,1.350000000000000000e+02,1.330000000000000000e+02,1.300000000000000000e+02,7.500000000000000000e+02,8.650000000000000000e+02,8.660000000000000000e+02,1.040000000000000000e+02,7.480000000000000000e+02,8.670000000000000000e+02,1.020000000000000000e+02,7.450000000000000000e+02,9.900000000000000000e+01 50 | 3.100000000000000000e+01,2.200000000000000000e+01,3.200000000000000000e+01,8.690000000000000000e+02,8.700000000000000000e+02,8.710000000000000000e+02,5.880000000000000000e+02,8.720000000000000000e+02,8.730000000000000000e+02,6.550000000000000000e+02,5.860000000000000000e+02,8.740000000000000000e+02,6.530000000000000000e+02,5.830000000000000000e+02,6.500000000000000000e+02 51 | 2.200000000000000000e+01,1.300000000000000000e+01,2.300000000000000000e+01,8.790000000000000000e+02,8.800000000000000000e+02,8.810000000000000000e+02,6.540000000000000000e+02,8.820000000000000000e+02,8.830000000000000000e+02,8.840000000000000000e+02,6.510000000000000000e+02,8.850000000000000000e+02,8.860000000000000000e+02,6.470000000000000000e+02,8.870000000000000000e+02 52 | 3.200000000000000000e+01,3.300000000000000000e+01,4.100000000000000000e+01,5.600000000000000000e+02,5.630000000000000000e+02,5.650000000000000000e+02,5.800000000000000000e+02,8.950000000000000000e+02,8.960000000000000000e+02,8.970000000000000000e+02,5.810000000000000000e+02,8.980000000000000000e+02,8.990000000000000000e+02,5.820000000000000000e+02,9.000000000000000000e+02 53 | 3.300000000000000000e+01,3.400000000000000000e+01,4.100000000000000000e+01,9.600000000000000000e+01,1.000000000000000000e+02,1.030000000000000000e+02,8.970000000000000000e+02,9.050000000000000000e+02,9.060000000000000000e+02,1.550000000000000000e+02,8.990000000000000000e+02,9.070000000000000000e+02,1.580000000000000000e+02,9.000000000000000000e+02,1.600000000000000000e+02 54 | 2.700000000000000000e+01,3.600000000000000000e+01,2.600000000000000000e+01,3.240000000000000000e+02,3.230000000000000000e+02,3.220000000000000000e+02,9.090000000000000000e+02,9.100000000000000000e+02,9.110000000000000000e+02,3.910000000000000000e+02,9.120000000000000000e+02,9.130000000000000000e+02,3.900000000000000000e+02,9.140000000000000000e+02,3.890000000000000000e+02 55 | 1.600000000000000000e+01,2.700000000000000000e+01,2.600000000000000000e+01,9.190000000000000000e+02,9.200000000000000000e+02,9.210000000000000000e+02,6.680000000000000000e+02,9.220000000000000000e+02,9.230000000000000000e+02,9.090000000000000000e+02,6.700000000000000000e+02,9.240000000000000000e+02,9.120000000000000000e+02,6.710000000000000000e+02,9.140000000000000000e+02 56 | 1.600000000000000000e+01,1.700000000000000000e+01,2.700000000000000000e+01,3.700000000000000000e+02,3.740000000000000000e+02,3.770000000000000000e+02,9.190000000000000000e+02,9.290000000000000000e+02,9.300000000000000000e+02,8.410000000000000000e+02,9.200000000000000000e+02,9.310000000000000000e+02,8.400000000000000000e+02,9.210000000000000000e+02,8.380000000000000000e+02 57 | 2.300000000000000000e+01,1.400000000000000000e+01,1.300000000000000000e+01,7.420000000000000000e+02,7.430000000000000000e+02,7.440000000000000000e+02,8.870000000000000000e+02,9.330000000000000000e+02,9.340000000000000000e+02,4.340000000000000000e+02,8.860000000000000000e+02,9.360000000000000000e+02,4.310000000000000000e+02,8.840000000000000000e+02,4.270000000000000000e+02 58 | 5.000000000000000000e+00,6.000000000000000000e+00,1.600000000000000000e+01,6.880000000000000000e+02,6.870000000000000000e+02,6.860000000000000000e+02,7.370000000000000000e+02,9.370000000000000000e+02,9.380000000000000000e+02,2.550000000000000000e+02,7.350000000000000000e+02,9.390000000000000000e+02,2.540000000000000000e+02,7.320000000000000000e+02,2.520000000000000000e+02 59 | 1.300000000000000000e+01,2.200000000000000000e+01,1.200000000000000000e+01,8.810000000000000000e+02,8.800000000000000000e+02,8.790000000000000000e+02,9.410000000000000000e+02,9.420000000000000000e+02,9.430000000000000000e+02,9.440000000000000000e+02,9.450000000000000000e+02,9.460000000000000000e+02,9.470000000000000000e+02,9.480000000000000000e+02,9.490000000000000000e+02 60 | 2.200000000000000000e+01,1.100000000000000000e+01,1.200000000000000000e+01,9.600000000000000000e+02,9.610000000000000000e+02,9.620000000000000000e+02,9.440000000000000000e+02,9.630000000000000000e+02,9.640000000000000000e+02,9.650000000000000000e+02,9.470000000000000000e+02,9.660000000000000000e+02,9.670000000000000000e+02,9.490000000000000000e+02,9.680000000000000000e+02 61 | 2.200000000000000000e+01,3.100000000000000000e+01,2.100000000000000000e+01,8.710000000000000000e+02,8.700000000000000000e+02,8.690000000000000000e+02,9.790000000000000000e+02,9.800000000000000000e+02,9.810000000000000000e+02,8.640000000000000000e+02,9.820000000000000000e+02,9.830000000000000000e+02,8.610000000000000000e+02,9.840000000000000000e+02,8.550000000000000000e+02 62 | 2.200000000000000000e+01,2.100000000000000000e+01,1.100000000000000000e+01,9.790000000000000000e+02,9.820000000000000000e+02,9.840000000000000000e+02,9.600000000000000000e+02,9.890000000000000000e+02,9.900000000000000000e+02,9.910000000000000000e+02,9.610000000000000000e+02,9.920000000000000000e+02,9.930000000000000000e+02,9.620000000000000000e+02,9.940000000000000000e+02 63 | 2.100000000000000000e+01,4.000000000000000000e+01,3.000000000000000000e+01,8.460000000000000000e+02,8.470000000000000000e+02,8.480000000000000000e+02,9.990000000000000000e+02,1.000000000000000000e+03,1.001000000000000000e+03,8.240000000000000000e+02,1.002000000000000000e+03,1.003000000000000000e+03,8.230000000000000000e+02,1.004000000000000000e+03,8.210000000000000000e+02 64 | 1.000000000000000000e+01,1.900000000000000000e+01,9.000000000000000000e+00,1.009000000000000000e+03,1.010000000000000000e+03,1.011000000000000000e+03,1.012000000000000000e+03,1.013000000000000000e+03,1.014000000000000000e+03,7.070000000000000000e+02,1.015000000000000000e+03,1.016000000000000000e+03,7.050000000000000000e+02,1.017000000000000000e+03,7.020000000000000000e+02 65 | 9.000000000000000000e+00,1.800000000000000000e+01,8.000000000000000000e+00,6.980000000000000000e+02,6.970000000000000000e+02,6.960000000000000000e+02,1.028000000000000000e+03,1.029000000000000000e+03,1.030000000000000000e+03,1.031000000000000000e+03,1.032000000000000000e+03,1.033000000000000000e+03,1.034000000000000000e+03,1.035000000000000000e+03,1.036000000000000000e+03 66 | 3.000000000000000000e+01,1.900000000000000000e+01,2.000000000000000000e+01,8.000000000000000000e+02,8.030000000000000000e+02,8.050000000000000000e+02,1.047000000000000000e+03,1.048000000000000000e+03,1.049000000000000000e+03,1.050000000000000000e+03,1.051000000000000000e+03,1.052000000000000000e+03,1.053000000000000000e+03,1.054000000000000000e+03,1.055000000000000000e+03 67 | 2.000000000000000000e+00,1.000000000000000000e+00,0.000000000000000000e+00,1.066000000000000000e+03,1.067000000000000000e+03,1.068000000000000000e+03,4.670000000000000000e+02,1.069000000000000000e+03,1.070000000000000000e+03,1.071000000000000000e+03,4.690000000000000000e+02,1.072000000000000000e+03,1.073000000000000000e+03,4.700000000000000000e+02,1.074000000000000000e+03 68 | 2.000000000000000000e+00,1.100000000000000000e+01,1.000000000000000000e+00,1.085000000000000000e+03,1.086000000000000000e+03,1.087000000000000000e+03,1.066000000000000000e+03,1.088000000000000000e+03,1.089000000000000000e+03,1.090000000000000000e+03,1.067000000000000000e+03,1.091000000000000000e+03,1.092000000000000000e+03,1.068000000000000000e+03,1.093000000000000000e+03 69 | 7.000000000000000000e+00,8.000000000000000000e+00,1.800000000000000000e+01,1.101000000000000000e+03,1.102000000000000000e+03,1.103000000000000000e+03,4.160000000000000000e+02,1.104000000000000000e+03,1.105000000000000000e+03,1.036000000000000000e+03,4.140000000000000000e+02,1.106000000000000000e+03,1.034000000000000000e+03,4.110000000000000000e+02,1.031000000000000000e+03 70 | 9.000000000000000000e+00,8.000000000000000000e+00,0.000000000000000000e+00,1.028000000000000000e+03,1.032000000000000000e+03,1.035000000000000000e+03,1.111000000000000000e+03,1.112000000000000000e+03,1.113000000000000000e+03,1.114000000000000000e+03,1.115000000000000000e+03,1.116000000000000000e+03,1.117000000000000000e+03,1.118000000000000000e+03,1.119000000000000000e+03 71 | 8.000000000000000000e+00,7.000000000000000000e+00,0.000000000000000000e+00,1.103000000000000000e+03,1.102000000000000000e+03,1.101000000000000000e+03,1.114000000000000000e+03,1.127000000000000000e+03,1.128000000000000000e+03,1.810000000000000000e+02,1.117000000000000000e+03,1.129000000000000000e+03,1.850000000000000000e+02,1.119000000000000000e+03,1.880000000000000000e+02 72 | 1.100000000000000000e+01,2.000000000000000000e+00,1.200000000000000000e+01,1.087000000000000000e+03,1.086000000000000000e+03,1.085000000000000000e+03,9.650000000000000000e+02,1.131000000000000000e+03,1.132000000000000000e+03,1.133000000000000000e+03,9.670000000000000000e+02,1.134000000000000000e+03,1.135000000000000000e+03,9.680000000000000000e+02,1.136000000000000000e+03 73 | 2.000000000000000000e+00,1.300000000000000000e+01,1.200000000000000000e+01,5.520000000000000000e+02,5.510000000000000000e+02,5.490000000000000000e+02,1.133000000000000000e+03,1.141000000000000000e+03,1.142000000000000000e+03,9.410000000000000000e+02,1.135000000000000000e+03,1.143000000000000000e+03,9.450000000000000000e+02,1.136000000000000000e+03,9.480000000000000000e+02 74 | 3.000000000000000000e+01,1.100000000000000000e+01,2.100000000000000000e+01,1.145000000000000000e+03,1.146000000000000000e+03,1.147000000000000000e+03,1.004000000000000000e+03,1.148000000000000000e+03,1.149000000000000000e+03,9.940000000000000000e+02,1.002000000000000000e+03,1.150000000000000000e+03,9.930000000000000000e+02,9.990000000000000000e+02,9.910000000000000000e+02 75 | 1.100000000000000000e+01,3.000000000000000000e+01,2.000000000000000000e+01,1.147000000000000000e+03,1.146000000000000000e+03,1.145000000000000000e+03,1.155000000000000000e+03,1.156000000000000000e+03,1.157000000000000000e+03,1.047000000000000000e+03,1.158000000000000000e+03,1.159000000000000000e+03,1.051000000000000000e+03,1.160000000000000000e+03,1.054000000000000000e+03 76 | 1.900000000000000000e+01,1.000000000000000000e+01,2.000000000000000000e+01,1.011000000000000000e+03,1.010000000000000000e+03,1.009000000000000000e+03,1.050000000000000000e+03,1.165000000000000000e+03,1.166000000000000000e+03,1.167000000000000000e+03,1.053000000000000000e+03,1.168000000000000000e+03,1.169000000000000000e+03,1.055000000000000000e+03,1.170000000000000000e+03 77 | 1.000000000000000000e+01,9.000000000000000000e+00,0.000000000000000000e+00,1.012000000000000000e+03,1.015000000000000000e+03,1.017000000000000000e+03,1.175000000000000000e+03,1.176000000000000000e+03,1.177000000000000000e+03,1.111000000000000000e+03,1.178000000000000000e+03,1.179000000000000000e+03,1.115000000000000000e+03,1.180000000000000000e+03,1.118000000000000000e+03 78 | 1.000000000000000000e+00,1.100000000000000000e+01,1.000000000000000000e+01,1.093000000000000000e+03,1.092000000000000000e+03,1.090000000000000000e+03,1.185000000000000000e+03,1.186000000000000000e+03,1.187000000000000000e+03,1.188000000000000000e+03,1.189000000000000000e+03,1.190000000000000000e+03,1.191000000000000000e+03,1.192000000000000000e+03,1.193000000000000000e+03 79 | 2.000000000000000000e+01,1.000000000000000000e+01,1.100000000000000000e+01,1.170000000000000000e+03,1.169000000000000000e+03,1.167000000000000000e+03,1.160000000000000000e+03,1.201000000000000000e+03,1.202000000000000000e+03,1.193000000000000000e+03,1.158000000000000000e+03,1.203000000000000000e+03,1.191000000000000000e+03,1.155000000000000000e+03,1.188000000000000000e+03 80 | 1.000000000000000000e+00,1.000000000000000000e+01,0.000000000000000000e+00,1.185000000000000000e+03,1.189000000000000000e+03,1.192000000000000000e+03,1.071000000000000000e+03,1.205000000000000000e+03,1.206000000000000000e+03,1.175000000000000000e+03,1.073000000000000000e+03,1.207000000000000000e+03,1.178000000000000000e+03,1.074000000000000000e+03,1.180000000000000000e+03 81 | -------------------------------------------------------------------------------- /include/AuxFuncs.hpp: -------------------------------------------------------------------------------- 1 | #ifndef AUX_FUNCS_HPP 2 | #define AUX_FUNCS_HPP 3 | 4 | 5 | #ifndef EIGEN_INC_HPP 6 | #include 7 | #endif 8 | 9 | #include 10 | 11 | //! AUXILARY FUNCTIONS FOR POSTMESH 12 | ALWAYS_INLINE std::vector &split(const std::string &s, char delim, std::vector &elems) { 13 | //! SPLIT STRINGS 14 | std::stringstream ss(s); 15 | std::string item; 16 | while (std::getline(ss, item, delim)) { 17 | elems.push_back(item); 18 | } 19 | return elems; 20 | } 21 | 22 | ALWAYS_INLINE std::vector split(const std::string &s, char delim) { 23 | //! SPLIT STRINGS 24 | std::vector elems; 25 | split(s, delim, elems); 26 | return elems; 27 | } 28 | 29 | 30 | template 31 | ALWAYS_INLINE void print(std::vector& arr) 32 | { 33 | //! PRINT FUNCTION OVERLOADED FOR STL VECTORS 34 | 35 | std::cout << "\n"; 36 | for (typename std::vector::const_iterator i=arr.begin(); i 44 | ALWAYS_INLINE void print(std::vector >& arr) 45 | { 46 | //! PRINT FUNCTION OVERLOADED FOR STL VECTORS OF VECTORS 47 | 48 | std::cout << "\n"; 49 | for (auto &i: arr) 50 | { 51 | for (auto &j: i) 52 | { 53 | std::cout << j << " "; 54 | } 55 | std::cout << "\n"; 56 | } 57 | std::cout << std::endl; 58 | } 59 | 60 | template 61 | ALWAYS_INLINE void print(T&& last) 62 | { 63 | //! PRINT FUNCTION OVERLOADED FOR GENERIC TYPE T 64 | std::cout << last << "\n"; 65 | } 66 | 67 | template 68 | ALWAYS_INLINE void print(U&& first, T&&... rest) 69 | { 70 | //! PRINT FUNCTION OVERLOADED USING VARIADIC TEMPLATE ARGUMENTS 71 | std::cout << first << " "; 72 | print(std::forward(rest)...); 73 | } 74 | 75 | ALWAYS_INLINE void print(gp_Pnt pnt, Real scale = 1.) 76 | { 77 | //! PRINT FUNCTION OVERLOADED USING gp_Pnt 78 | std::cout << pnt.X()/scale << " " << pnt.Y()/scale << " " << pnt.Z()/scale << "\n"; 79 | } 80 | 81 | template 82 | ALWAYS_INLINE void warn(T&& last) 83 | { 84 | //! WARN FUNCTION FOR GENERIC TYPE T 85 | std::cerr << last << std::endl; 86 | } 87 | 88 | template 89 | ALWAYS_INLINE void warn(U&& first, T&&... rest) 90 | { 91 | //! WARN FUNCTION OVERLOADED USING VARIADIC TEMPLATE ARGUMENTS 92 | std::cerr << first << " "; 93 | warn(std::forward(rest)...); 94 | } 95 | 96 | 97 | 98 | template 99 | std::chrono::duration timer(T (*func)(Params...), Args&&...args) 100 | { 101 | //! Generic timer function for measuring elapsed time on a given 102 | //! function. For simple functions with no overload, pass the 103 | //! function to timer function directly, followed by arguments 104 | //! 105 | //! for example: Given a function 106 | //! 107 | //! int silly_add(double a, double b) 108 | //! return reinterpret_cast(a+b); 109 | //! 110 | //! To measure the time spent on this function, call the timer as 111 | //! 112 | //! timer(silly_add,a,b); 113 | //! 114 | //! For overloaded functions, since a pointer to an overloaded function 115 | //! can be ambiguous, you need to use static_cast 116 | //! 117 | //! for example: Given a function 118 | //! 119 | //! double simple_mul(double a,double b) 120 | //! return a*b; 121 | //! 122 | //! with overload 123 | //! 124 | //! double simple_mul(double a, double b, double c) 125 | //! return a*b*c; 126 | //! 127 | //! call the timer function on the first overload as 128 | //! 129 | //! timer(static_cast(&simple_mul),a,b); 130 | //! 131 | //! and on the second overload as 132 | //! 133 | //! timer(static_cast(&simple_mul),a,b,c); 134 | //! 135 | //! you can also explicitly create a function pointer and pass it as follows: 136 | //! 137 | //! double (*simple_mul_ptr)(double,double) = &simple_mul; 138 | //! 139 | //! then 140 | //! 141 | //! timer(simple_mul_ptr,a,b); 142 | 143 | 144 | 145 | std::chrono::time_point start, end; 146 | start = std::chrono::system_clock::now(); 147 | 148 | func(std::forward(args)...); 149 | 150 | end = std::chrono::system_clock::now(); 151 | std::chrono::duration elapsed_seconds = end-start; 152 | 153 | if (elapsed_seconds.count() >= 1.0e-3 && elapsed_seconds.count() < 1.) 154 | { 155 | // Alternatively duration_cast can also be used but decimal digits would be lost 156 | //std::chrono::duration_cast(elapsed_seconds).count(); 157 | std::cout << "Elapsed time is "<< elapsed_seconds.count()/1.0e-03 << " ms" << std::endl; 158 | } 159 | else if (elapsed_seconds.count() >= 1.0e-6 && elapsed_seconds.count() < 1.0e-3) 160 | { 161 | // Alternatively duration_cast can also be used but decimal digits would be lost 162 | //std::chrono::duration_cast(elapsed_seconds).count(); 163 | std::cout << "Elapsed time is "<< elapsed_seconds.count()/1.0e-06 << " \xC2\xB5s" << std::endl; 164 | } 165 | else if (elapsed_seconds.count() < 1.0e-6) 166 | { 167 | // Alternatively duration_cast can also be used but decimal digits would be lost 168 | //std::chrono::duration_cast(elapsed_seconds).count(); 169 | std::cout << "Elapsed time is "<< elapsed_seconds.count()/1.0e-09 << " ns" << std::endl; 170 | } 171 | else 172 | { 173 | // Alternatively duration_cast can also be used but decimal digits would be lost 174 | //std::chrono::duration_cast(elapsed_seconds).count(); 175 | std::cout << "Elapsed time is "<< elapsed_seconds.count()<< " s" << std::endl; 176 | } 177 | 178 | return elapsed_seconds; 179 | } 180 | 181 | 182 | template 183 | double timeit(T (*func)(Params...), Args&&...args) 184 | { 185 | //! IMPORTANT: Do not pass functions to timeit which mutate/modify their input 186 | //! arguments (unless you are completely certain it does not affect the timing), 187 | //! since the same function with modified arguments will have a different run-time. 188 | //! 189 | //! Generic timer function for accurately measuring elapsed time on a 190 | //! given function. timeit runs a function many times and gives the average of all 191 | //! run-time. When invoked on a function, it uses perfect forwarding to pass 192 | //! arguments to the callee function with zero-overhead. 193 | //! 194 | //! Additionally, for hot micro-benchmarking, timeit skips the first 195 | //! few runs to avoid cold runs. 196 | //! 197 | //! For simple functions with no other overloads, pass the 198 | //! function to timer function directly, followed by arguments 199 | //! 200 | //! for example: Given a function 201 | //! 202 | //! int silly_add(double a, double b) 203 | //! return reinterpret_cast(a+b); 204 | //! 205 | //! To measure the time spent on this function, call the timeit as 206 | //! 207 | //! timeit(silly_add,a,b); 208 | //! 209 | //! For overloaded functions, since a pointer to an overloaded function 210 | //! can be ambiguous, you need to use static_cast 211 | //! 212 | //! for example: Given a function 213 | //! 214 | //! double simple_mul(double a,double b) 215 | //! return a*b; 216 | //! 217 | //! with overload 218 | //! 219 | //! double simple_mul(double a, double b, double c) 220 | //! return a*b*c; 221 | //! 222 | //! call the timeit function on the first overload as 223 | //! 224 | //! timeit(static_cast(&simple_mul),a,b); 225 | //! 226 | //! and on the second overload as 227 | //! 228 | //! timeit(static_cast(&simple_mul),a,b,c); 229 | //! 230 | //! you can also explicitly create a function pointer and pass it as follows: 231 | //! 232 | //! double (*simple_mul_ptr)(double,double) = &simple_mul; 233 | //! 234 | //! then 235 | //! 236 | //! timeit(simple_mul_ptr,a,b); 237 | 238 | auto counter = 1.0; 239 | auto mean_time = 0.0; 240 | auto mean_time_hot = 0.0; 241 | auto no_skipped_first_few_iteration = 10; 242 | 243 | for (auto iter=0; iter<1e09; ++iter) 244 | { 245 | std::chrono::time_point start, end; 246 | start = std::chrono::system_clock::now(); 247 | 248 | func(std::forward(args)...); 249 | 250 | end = std::chrono::system_clock::now(); 251 | std::chrono::duration elapsed_seconds = end-start; 252 | 253 | // Timing from a cold start 254 | mean_time += elapsed_seconds.count(); 255 | 256 | // Start benchmarking hot 257 | if (counter>no_skipped_first_few_iteration) 258 | mean_time_hot +=elapsed_seconds.count(); 259 | 260 | counter++; 261 | 262 | if (mean_time > 0.5) 263 | { 264 | if ( (counter > no_skipped_first_few_iteration) && \ 265 | (counter > 2*no_skipped_first_few_iteration) ) { 266 | mean_time_hot /= (counter - no_skipped_first_few_iteration); 267 | mean_time = mean_time_hot; 268 | } 269 | else { 270 | mean_time /= counter; 271 | } 272 | 273 | if (mean_time >= 1.0e-3 && mean_time < 1.) 274 | std::cout << static_cast(counter-1) 275 | << " runs, average elapsed time is " 276 | << mean_time/1.0e-03 << " ms" << std::endl; 277 | else if (mean_time >= 1.0e-6 && mean_time < 1.0e-3) 278 | std::cout << static_cast(counter-1) 279 | << " runs, average elapsed time is " 280 | << mean_time/1.0e-06 << " \xC2\xB5s" << std::endl; 281 | else if (mean_time < 1.0e-6) 282 | std::cout << static_cast(counter-1) 283 | << " runs, average elapsed time is " 284 | << mean_time/1.0e-09 << " ns" << std::endl; 285 | else 286 | std::cout << static_cast(counter-1) 287 | << " runs, average elapsed time is " 288 | << mean_time << " s" << std::endl; 289 | 290 | break; 291 | } 292 | } 293 | return mean_time; 294 | } 295 | 296 | 297 | ALWAYS_INLINE std::string getcwdpath(void) 298 | { 299 | char cpath[FILENAME_MAX]; 300 | if (!getcwd(cpath, sizeof(cpath))) { 301 | throw std::invalid_argument("File name exceeds 255 character"); 302 | } 303 | cpath[sizeof(cpath) - 1] = '\0'; 304 | std::string path = std::string(cpath); 305 | return path; 306 | } 307 | 308 | ALWAYS_INLINE std::string getexepath() 309 | { 310 | char result[ PATH_MAX ]; 311 | ssize_t count = readlink( "/proc/self/exe", result, PATH_MAX ); 312 | return std::string( result, (count > 0) ? count : 0 ); 313 | } 314 | 315 | 316 | 317 | #endif // AUX_FUNCS_HPP -------------------------------------------------------------------------------- /include/CNPFuncs.hpp: -------------------------------------------------------------------------------- 1 | #ifndef CNP_FUNCS_HPP 2 | #define CNP_FUNCS_HPP 3 | 4 | #include 5 | #include 6 | 7 | template struct unique_container 8 | { 9 | std::vector uniques; 10 | std::vector unique_positions; 11 | }; 12 | 13 | // A LIST OF NUMPY-LIKE FUNCTIONS 14 | namespace cpp_numpy { 15 | 16 | template 17 | STATIC ALWAYS_INLINE 18 | Eigen::Matrix arange(T a, T b) 19 | { 20 | //! EQUIVALENT TO NUMPY UNIQUE. GET A LINEARLY SPACED VECTOR 21 | return Eigen::Matrix::LinSpaced(Eigen::Sequential,(b-a),a,b-1); 23 | } 24 | 25 | template 26 | STATIC ALWAYS_INLINE 27 | Eigen::Matrix 28 | arange(T b=1) 29 | { 30 | //! EQUIVALENT TO NUMPY UNIQUE. GET A LINEARLY SPACED VECTOR 31 | //! DEFAULT ARANGE STARTING FROM ZERO AND ENDING AT 1. 32 | //! b IS OPTIONAL AND A IS ALWAYS ZERO 33 | 34 | Integer a = 0; 35 | return Eigen::Matrix::LinSpaced(Integer(Integer(b)-a),Integer(a),Integer(Integer(b)-1)); 37 | } 38 | 39 | template 40 | STATIC ALWAYS_INLINE T 41 | take(const Eigen::PlainObjectBase &arr, const Eigen::PlainObjectBase &arr_row, const Eigen::PlainObjectBase &arr_col) 42 | { 43 | //! TAKE OUT PART OF A 2D ARRAY. MAKES A COPY 44 | T arr_reduced; 45 | arr_reduced.setZero(arr_row.rows(),arr_col.rows()); 46 | 47 | for (auto i=0; i 59 | STATIC ALWAYS_INLINE T take(const Eigen::PlainObjectBase &arr, const Eigen::MatrixI &arr_idx) 60 | { 61 | //! TAKE OUT PART OF A 2D ARRAY. MAKES A COPY 62 | assert (arr_idx.rows()<=arr.rows()); 63 | assert (arr_idx.cols()<=arr.cols()); 64 | 65 | T arr_reduced; 66 | arr_reduced.setZero(arr_idx.rows(),arr_idx.cols()); 67 | 68 | for (auto i=0; i 80 | void STATIC put(Eigen::PlainObjectBase &arr_to_put, const Eigen::PlainObjectBase &arr_to_take, 81 | const Eigen::PlainObjectBase &arr_row, const Eigen::PlainObjectBase &arr_col) 82 | { 83 | //! PUT A SUBARRAY INTO AN ARRAY. THIS IS IN-PLACE OPERATION 84 | assert(arr_to_put.rows()==arr_to_take.rows() 85 | && arr_to_put.cols()==arr_to_take.cols() 86 | && "ARRAY_TO_PUT_AND_ARRAY_TO_TAKE_VALUES_FROM_SHOULD_HAVE_THE_SAME_VALUES"); 87 | 88 | for (auto i=0; i 98 | void STATIC put(Eigen::PlainObjectBase &arr_to_put, typename Eigen::PlainObjectBase::Scalar value, 99 | const Eigen::PlainObjectBase &arr_row, const Eigen::PlainObjectBase &arr_col) 100 | { 101 | //! PUT A VALUE INTO PART OF AN ARRAY. THIS IS IN-PLACE OPERATION 102 | for (auto i=0; i 121 | STATIC std::vector argsort(const std::vector &v) 122 | { 123 | //! GET INDICES OF A SORTED VECTOR 124 | // INITIALIZE ORIGINAL INDEX LOCATIONS 125 | std::vector idx(v.size()); 126 | std::iota(idx.begin(),idx.end(),0); 127 | // SORT INDICES BY COMPARING VALUES IN V USING LAMBDA FUNCTION 128 | std::sort(idx.begin(), idx.end(),[&v](Integer i1, Integer i2) {return v[i1] < v[i2];}); 129 | 130 | return idx; 131 | } 132 | 133 | template 134 | STATIC ALWAYS_INLINE void sort_rows(std::vector> &arr) 135 | { 136 | //! SORTS A 2D ARRAY ROW BY ROW - IN-PLACE 137 | for (auto &k: arr) std::sort(k.begin(),k.end()); 138 | } 139 | 140 | template 141 | STATIC ALWAYS_INLINE void sort_rows(Eigen::MatrixBase &arr) 142 | { 143 | //! SORTS A 2D ARRAY ROW BY ROW - IN-PLACE 144 | for (auto i=0; i 151 | STATIC void sort_rows(Eigen::PlainObjectBase &arr, Eigen::MatrixI &idx) 152 | { 153 | //! SORTS A 2D ARRAY ROW BY ROW AND RETURN INDICES - IN-PLACE 154 | for (auto i=0; i row_indices; 157 | std::vector::Scalar> row_arr; 158 | row_arr.assign(arr.row(i).data(),arr.row(i).data()+arr.row(i).size()); 159 | row_indices = argsort(row_arr); 160 | idx.block(i,0,1,idx.cols()) = \ 161 | Eigen::Map(row_indices.data(),1,row_indices.size()); 162 | // SORT THE ACTUAL ARRAY NOW 163 | std::sort(arr.row(i).data(),arr.row(i).data()+arr.row(i).size()); 164 | } 165 | } 166 | 167 | template 168 | STATIC void sort_back_rows(Eigen::PlainObjectBase &arr, const Eigen::MatrixI &idx) 169 | { 170 | //! SORTS BACK THE ARRAY ROW-WISE TO ITS ORIGINAL SHAPE GIVEN THE SORT INDICES IDX. 171 | //! NO COPY INVOLVED 172 | assert (idx.rows()==arr.rows() && idx.cols()==arr.cols()); 173 | 174 | for (auto i=0; i 187 | STATIC ALWAYS_INLINE Eigen::Matrix 188 | ravel(Eigen::Matrix &arr) 189 | { 190 | //! RAVEL/FLATTEN THE ARRAY RESPECTING DATA CONTIGUOUSNESS. MAKES A COPY 191 | return Eigen::Map > 192 | (arr.data(),arr.rows()*arr.cols(),1); 193 | } 194 | 195 | template 196 | std::tuple 197 | STATIC ALWAYS_INLINE where_eq(const Eigen::PlainObjectBase &arr, 198 | U num, Real tolerance=1e-14) 199 | { 200 | //! FIND THE OCCURENCES OF VALUE IN A MATRIX 201 | std::vector idx_rows; 202 | std::vector idx_cols; 203 | idx_rows.clear(); idx_cols.clear(); 204 | for (Integer i=0; i 218 | (idx_rows.data(),idx_rows.size(),1), 219 | Eigen::Map 220 | (idx_cols.data(),idx_cols.size(),1)); 221 | } 222 | 223 | template 224 | STATIC ALWAYS_INLINE Eigen::PlainObjectBase 225 | append(const Eigen::PlainObjectBase &arr, U num) 226 | { 227 | //! APPEND TO AN EIGEN VECTOR, SIMILAR TO PUSH_BACK. MAKES A COPY 228 | assert(arr.cols()==1 && "YOU CANNOT APPEND TO MULTI-DIMENSIONAL MATRICES. " 229 | "APPEND IS STRICTLY FOR MATRICES WITH COLS()==1"); 230 | 231 | Eigen::PlainObjectBase new_arr; 232 | new_arr.setZero(arr.rows()+1,1); 233 | new_arr.block(0,0,arr.rows(),1) = arr; 234 | new_arr(arr.rows()) = static_cast::Scalar>(num); 235 | 236 | return new_arr; 237 | } 238 | 239 | template 240 | STATIC ALWAYS_INLINE std::vector > 241 | toSTL(const Eigen::Matrix &arr) 242 | { 243 | //! CONVERT EIGEN MATRIX TO STL VECTOR OF VECTORS. 244 | //! IS STRICTLY VALID FOR MATRICES 245 | 246 | std::vector > arr_stl(arr.rows()); 247 | for (auto i=0; i < arr.rows(); ++i) 248 | { 249 | std::vector current_row(arr.cols()); 250 | for (auto j=0; j < arr.cols(); ++j) 251 | { 252 | current_row[j] = arr(i,j); 253 | } 254 | arr_stl[i] = current_row; 255 | } 256 | return arr_stl; 257 | } 258 | 259 | template 260 | STATIC ALWAYS_INLINE Eigen::Matrix 261 | toEigen(const std::vector > &arr_stl) 262 | { 263 | //! CONVERT STL VECTOR OF VECTORS TO EIGEN MATRIX. 264 | //! ALL VECTORS SHOULD HAVE THE SAME LENGTH (STRUCTURED) 265 | 266 | Eigen::Matrix arr(arr_stl.size(),arr_stl[0].size()); 267 | for (UInteger i=0; i < arr_stl.size(); ++i) 268 | { 269 | for (UInteger j=0; j < arr_stl[0].size(); ++j) 270 | { 271 | arr(i,j) = arr_stl[i][j]; 272 | } 273 | } 274 | return arr; 275 | } 276 | 277 | template 278 | STATIC ALWAYS_INLINE std::vector intersect(const std::vector& vec1, const std::vector& vec2) 279 | { 280 | std::vector commons; 281 | for (auto &iter1: vec1) 282 | { 283 | for (auto &iter2: vec2) 284 | { 285 | if (iter1==iter2) 286 | { 287 | commons.push_back(iter1); 288 | break; 289 | } 290 | } 291 | } 292 | 293 | return commons; 294 | } 295 | 296 | template 297 | STATIC ALWAYS_INLINE std::vector intersect(const std::vector& vec1, const std::vector& vec2, const std::vector& ... rest) 298 | { 299 | auto commons = intersect(vec1,vec2); 300 | commons = intersect(commons,rest...); 301 | return commons; 302 | } 303 | 304 | template 305 | STATIC ALWAYS_INLINE std::tuple::Scalar>,std::vector > 306 | unique(const Eigen::PlainObjectBase &arr) 307 | { 308 | //! RETURNS UNIQUE VALUES AND UNIQUE INDICES OF AN EIGEN MATRIX 309 | assert(arr.cols()==1 && "UNIQUE_METHOD_IS_ONLY_AVAILABLE_FOR_1D_ARRAYS/MATRICES"); 310 | std::vector::Scalar> uniques; 311 | std::vector idx; 312 | 313 | for (auto i=0; i idx_sorted(idx.size()); 332 | for (UInteger i=0; i::Scalar>,std::vector > 337 | uniques_idx = std::make_tuple(uniques,idx_sorted); 338 | 339 | return uniques_idx; 340 | } 341 | 342 | template 343 | STATIC ALWAYS_INLINE std::tuple,std::vector > 344 | unique(const std::vector &v, bool return_index=false) 345 | { 346 | //! RETURNS UNIQUE VALUES AND UNIQUE INDICES OF A STD::VECTOR 347 | if (return_index == false) { 348 | std::vector uniques(v.begin(),v.end()); 349 | std::sort(uniques.begin(),uniques.end()); 350 | uniques.erase(std::unique(uniques.begin(),uniques.end()),uniques.end()); 351 | 352 | return std::make_tuple(uniques,std::vector(0)); 353 | } 354 | 355 | auto sorter = argsort(v); 356 | auto last = std::unique(sorter.begin(),sorter.end(),[&v](T a, T b){return v[a]==v[b];}); 357 | sorter.erase(last,sorter.end()); 358 | 359 | std::vector uniques(sorter.size()); 360 | auto counter = 0; 361 | for (auto &k: sorter) { 362 | uniques[counter] = v[k]; 363 | counter++; 364 | } 365 | 366 | return std::make_tuple(uniques,sorter); 367 | } 368 | 369 | template 370 | STATIC ALWAYS_INLINE Eigen::Matrix::Scalar,DYNAMIC,DYNAMIC> 371 | itemfreq(const Eigen::PlainObjectBase &arr) 372 | { 373 | //! FINDS THE NUMBER OF OCCURENCE OF EACH VALUE IN AN EIGEN MATRIX 374 | std::vector::Scalar> uniques; 375 | std::tie(uniques,std::ignore) = unique(arr); 376 | Eigen::Matrix::Scalar,DYNAMIC,DYNAMIC> freqs; 377 | freqs.setZero(uniques.size(),2); 378 | 379 | auto counter = 0; 380 | for (auto &i: uniques) 381 | { 382 | Integer counts = std::count(arr.data(),arr.data()+arr.rows(),i); 383 | freqs(counter,0) = i; 384 | freqs(counter,1) = counts; 385 | counter++; 386 | } 387 | 388 | return freqs; 389 | } 390 | 391 | template 392 | STATIC ALWAYS_INLINE 393 | Eigen::Matrix itemfreq(const std::vector &arr) 394 | { 395 | //! FINDS THE NUMBER OF OCCURENCE OF EACH VALUE IN A VECTOR 396 | std::vector uniques; 397 | std::tie(uniques,std::ignore) = unique(arr,false); 398 | Eigen::Matrix freqs(uniques.size(),2); 399 | 400 | auto counter = 0; 401 | for (auto &i: uniques) 402 | { 403 | Integer counts = std::count(arr.begin(),arr.end(),i); 404 | freqs(counter,0) = i; 405 | freqs(counter,1) = counts; 406 | counter++; 407 | } 408 | 409 | return freqs; 410 | } 411 | 412 | 413 | } 414 | // end of namespace 415 | 416 | // SHORTEN THE NAMESPACE 417 | namespace cnp = cpp_numpy; 418 | 419 | #endif // CNP_FUNCS_H 420 | -------------------------------------------------------------------------------- /include/EIGEN_INC.hpp: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_INC_HPP 2 | #define EIGEN_INC_HPP 3 | 4 | 5 | #ifndef STL_INC_HPP 6 | #define STL_INC_HPP 7 | #include 8 | #endif 9 | 10 | #define EIGEN_VECTORIZE 11 | #define EIGEN_DEFAULT_TO_ROW_MAJOR 12 | #define EIGEN_HAVE_RVALUE_REFERENCES 13 | 14 | #include 15 | #include 16 | #include 17 | 18 | // DEFINE STORAGE ORDERS 19 | #define C_Contiguous Eigen::RowMajor 20 | #define F_Contiguous Eigen::ColMajor 21 | // GENERIC ALIGNED 22 | #define POSTMESH_ALIGNED C_Contiguous 23 | 24 | 25 | // DYNAMIC MATRICES 26 | #define DYNAMIC Eigen::Dynamic 27 | 28 | 29 | // FOR EIGEN WRAPPER 30 | //#define MAP_DATA // DEFAULT, NOT USED 31 | //#define WRAP_DATA // UNCOMMENT THIS IF YOU WANT TO WRAP THE DATA 32 | 33 | namespace Eigen { 34 | // DEFINE Real, Integer AND UInteger BASED MATRICES 35 | typedef Eigen::Matrix VectorR; 36 | typedef Eigen::Matrix VectorI; 37 | typedef Eigen::Matrix RowVectorR; 38 | typedef Eigen::Matrix RowVectorI; 39 | typedef Eigen::Matrix MatrixR; 40 | typedef Eigen::Matrix MatrixI; 41 | typedef Eigen::Matrix MatrixUI; 42 | 43 | 44 | #ifdef WRAP_DATA 45 | // AN EIGEN MATRIX WRAPPER OVER RAW BUFFERS (WHILE USING THIS WRAPPER 46 | // TO WRAP C-STYLE POINTERS DO NOT FREE THE MEMORY OWNED BY THE POINTER 47 | // EXPLICITLY, AS THE OWNERSHIP IS TRANSFERRED TO EIGEN MATRIX AND HENCE 48 | // EIGEN TAKES CARE OF DESTRUCTION, OTHERWISE YOU WILL END UP WITH DOUBLE 49 | // FREE CORRUPTION ISSUE) 50 | template struct WrapRawBuffer { 51 | // NOTE THAT THIS WRAPPER TRANSFERS OWNRSHIP OF THE DATA SO 52 | // ANY RESOURCE MANAGING CLASS LIKE SHARED_PTR, UNIQUE_PTR, 53 | // STD::VECTOR OR EIGEN MATRIX WILL DELETE THE DATA 54 | 55 | // THIS IS JUST TO USE AN EXISTING PIECE OF MEMORY AND TRANSFER 56 | // IT TO EIGEN MATRIX WITHOUT MAKING COPIES. EIGEN DOES NOT PROVIDE 57 | // A WRAPPER OVER RAW BUFFERS AND PROBABLY NEVER WILL BECAUSE OF ABI 58 | // COMPATIBILITIES AND API CONSISTENCY. 59 | 60 | // DO NOT USE THIS WRAPPER IF THE DATA IS USED (OR BELONGS TO) THE 61 | // OUTSIDE WORLD (BEYOND THE TRANSLATION UNITS THAT IMPORT THIS), 62 | // FOR INSTANCE IF THE DATA IS COMMING FROM PYTHON NUMPY ARRAYS 63 | 64 | // WITH POSTMESH MEMBER DATA THIS WRAPPER HAS TO BE USED IN 65 | // CONJUNCTION WITH MOVE SEMANTICS 66 | 67 | T* data; 68 | Eigen::DenseIndex rows, cols; 69 | Eigen::Matrix& asPostMeshMatrix(){ 70 | return reinterpret_cast&>(*this); 72 | } 73 | // NO DESTRUCTOR NEEDED, AS THEN WE WILL FREE THE MEMORY MORE THAN ONCE 74 | // ~WrapRawBuffer(){delete data;} 75 | }; 76 | #endif 77 | 78 | } 79 | 80 | 81 | #endif // EIGEN_INC_HPP 82 | 83 | -------------------------------------------------------------------------------- /include/OCC_INC.hpp: -------------------------------------------------------------------------------- 1 | #ifndef OCC_INC_HPP 2 | #define OCC_INC_HPP 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | #include 48 | #include 49 | #include 50 | #include 51 | #include 52 | #include 53 | #include 54 | #include 55 | #include 56 | #include 57 | #include 58 | 59 | 60 | //! Identifies the type of a curve. 61 | //! Not necessary to redefine as they are defined in OCC 62 | //! 63 | //enum GeomAbs_CurveType { 64 | // GeomAbs_Line, 65 | // GeomAbs_Circle, 66 | // GeomAbs_Ellipse, 67 | // GeomAbs_Hyperbola, 68 | // GeomAbs_Parabola, 69 | // GeomAbs_BezierCurve, 70 | // GeomAbs_BSplineCurve, 71 | // GeomAbs_OtherCurve 72 | //}; 73 | 74 | //! Identifies the type of a curve. 75 | //! Not necessary to redefine as they are defined in OCC 76 | //! 77 | //enum GeomAbs_SurfaceType { 78 | // GeomAbs_Plane, 79 | // GeomAbs_Cylinder, 80 | // GeomAbs_Cone, 81 | // GeomAbs_Sphere, 82 | // GeomAbs_Torus, 83 | // GeomAbs_BezierSurface, 84 | // GeomAbs_BSplineSurface, 85 | // GeomAbs_SurfaceOfRevolution, 86 | // GeomAbs_SurfaceOfExtrusion, 87 | // GeomAbs_OffsetSurface, 88 | // GeomAbs_OtherSurface 89 | //} 90 | 91 | #endif // OCC_INC_HPP 92 | 93 | -------------------------------------------------------------------------------- /include/PostMeshBase.hpp: -------------------------------------------------------------------------------- 1 | #ifndef POSTMESHBASE_HPP 2 | #define POSTMESHBASE_HPP 3 | 4 | #ifdef EIGEN_INC_HPP 5 | #include 6 | #endif 7 | 8 | #include 9 | 10 | #ifndef CNP_FUNCS_HPP 11 | #define CNP_FUNC_HPP 12 | #include 13 | #endif 14 | 15 | #include 16 | #include 17 | 18 | 19 | class PostMeshBase 20 | { 21 | public: 22 | //! PUBLIC MEMBER FUNCTIONS OF POSTMESH BASE CLASS. SHORTER FUNCTIONS ARE 23 | //! DECLARED AND DEFINED IN THE HEADER TO PROVIDE THEM WITH THE POSSIBILITY 24 | //! OF BEING INLINED BY THE COMPILER. ALTHOUGH DEEMED UN-NECESSARY, USER- 25 | //! DEFINED COPY/MOVE CONSTRUCTORS AND OPERATORS ARE IMPLEMENTED TO RESTRICT 26 | //! COPY OF DATA MEMBERS TO A SPECIFIC SET. 27 | 28 | ALWAYS_INLINE PostMeshBase() 29 | { 30 | this->scale = 1.0; 31 | this->condition = 1.0e10; 32 | this->projection_precision = 1.0e-04; 33 | } 34 | 35 | ALWAYS_INLINE PostMeshBase(std::string &element_type, const UInteger &dim) \ 36 | : mesh_element_type(element_type), ndim(dim) { 37 | this->condition = 1.0e10; 38 | this->scale = 1.; 39 | this->projection_precision = 1.0e-04; 40 | } 41 | 42 | PostMeshBase(const PostMeshBase& other) \ 43 | noexcept(std::is_copy_constructible::value); 44 | PostMeshBase& operator=(const PostMeshBase& other) \ 45 | noexcept(std::is_copy_assignable::value); 46 | PostMeshBase(PostMeshBase&& other) noexcept; 47 | PostMeshBase& operator=(PostMeshBase&& other) noexcept; 48 | 49 | ALWAYS_INLINE ~PostMeshBase() = default; 50 | 51 | ALWAYS_INLINE void Init(std::string &etype, const UInteger &dim) 52 | { 53 | this->mesh_element_type = etype; 54 | this->ndim = dim; 55 | this->scale = 1.0; 56 | this->condition = 1.0e10; 57 | this->projection_precision = 1.0e-04; 58 | } 59 | 60 | ALWAYS_INLINE void SetScale(const Real &scale) 61 | { 62 | this->scale = scale; 63 | } 64 | 65 | ALWAYS_INLINE void SetCondition(const Real &condition) 66 | { 67 | this->condition = condition; 68 | } 69 | 70 | ALWAYS_INLINE void SetProjectionPrecision(const Real &precision) 71 | { 72 | if (precision < 1e-01) 73 | this->projection_precision = precision; 74 | else 75 | std::cerr << "Prescribed precision " << precision << " too high. Decrease it." << std::endl; 76 | } 77 | 78 | ALWAYS_INLINE void SetProjectionCriteria(UInteger *criteria, const Integer &rows, const Integer &cols) 79 | { 80 | this->projection_criteria = Eigen::Map(criteria,rows,cols); 81 | } 82 | 83 | ALWAYS_INLINE void SetMeshElements(UInteger *arr, const Integer &rows, const Integer &cols) 84 | { 85 | #if !defined(WRAP_DATA) 86 | this->mesh_elements = Eigen::Map(arr,rows,cols); 87 | #else 88 | Eigen::WrapRawBuffer Wrapper; 89 | Wrapper.data = arr; Wrapper.rows = rows; Wrapper.cols = cols; 90 | this->mesh_elements = std::move(Wrapper.asPostMeshMatrix()); 91 | #endif 92 | } 93 | 94 | ALWAYS_INLINE void SetMeshPoints(Real *arr, const Integer &rows, const Integer &cols) 95 | { 96 | #if !defined(WRAP_DATA) 97 | this->mesh_points = Eigen::Map(arr,rows,cols); 98 | #else 99 | Eigen::WrapRawBuffer Wrapper; 100 | Wrapper.data = arr; Wrapper.rows = rows; Wrapper.cols = cols; 101 | this->mesh_points = std::move(Wrapper.asPostMeshMatrix()); 102 | #endif 103 | } 104 | 105 | ALWAYS_INLINE void SetMeshEdges(UInteger *arr, const Integer &rows, const Integer &cols) 106 | { 107 | #if !defined(WRAP_DATA) 108 | this->mesh_edges = Eigen::Map(arr,rows,cols); 109 | #else 110 | Eigen::WrapRawBuffer Wrapper; 111 | Wrapper.data = arr; Wrapper.rows = rows; Wrapper.cols = cols; 112 | this->mesh_edges = std::move(Wrapper.asPostMeshMatrix()); 113 | #endif 114 | } 115 | 116 | ALWAYS_INLINE void SetMeshFaces(UInteger *arr, const Integer &rows, const Integer &cols) 117 | { 118 | #if !defined(WRAP_DATA) 119 | this->mesh_faces = Eigen::Map(arr,rows,cols); 120 | #else 121 | Eigen::WrapRawBuffer Wrapper; 122 | Wrapper.data = arr; Wrapper.rows = rows; Wrapper.cols = cols; 123 | this->mesh_faces = std::move(Wrapper.asPostMeshMatrix()); 124 | #endif 125 | } 126 | 127 | ALWAYS_INLINE void ScaleMesh() 128 | { 129 | this->mesh_points *=this->scale; 130 | } 131 | 132 | ALWAYS_INLINE std::string GetMeshElementType() 133 | { 134 | return this->mesh_element_type; 135 | } 136 | 137 | ALWAYS_INLINE void SetNodalSpacing(Real *arr, const Integer &rows, const Integer &cols) 138 | { 139 | #if !defined(WRAP_DATA) 140 | this->fekete = Eigen::Map(arr,rows,cols); 141 | #else 142 | Eigen::WrapRawBuffer Wrapper; 143 | Wrapper.data = arr; Wrapper.rows = rows; Wrapper.cols = cols; 144 | this->fekete = std::move(Wrapper.asPostMeshMatrix()); 145 | #endif 146 | } 147 | 148 | ALWAYS_INLINE void ReturnModifiedMeshPoints(Real *points) 149 | { 150 | // RETURN MODIFIED MESH POINTS - INVOLVES DEEP COPY 151 | Eigen::Mapmesh_points)>(points, 152 | this->mesh_points.rows(), 153 | this->mesh_points.cols()) = this->mesh_points/this->scale; 154 | } 155 | 156 | void ReadIGES(const char *filename); 157 | void ReadSTEP(const char *filename); 158 | static Eigen::MatrixI Read(std::string &filename); 159 | static Eigen::MatrixUI ReadI(std::string &filename, char delim); 160 | static Eigen::MatrixR ReadR(std::string &filename, char delim); 161 | void CheckMesh(); 162 | 163 | void GetGeomVertices(); 164 | void GetGeomEdges(); 165 | void GetGeomFaces(); 166 | std::vector ObtainGeomVertices(); 167 | 168 | ALWAYS_INLINE Integer NbPoints() 169 | { 170 | return this->geometry_points.size(); 171 | } 172 | 173 | ALWAYS_INLINE Integer NbCurves() 174 | { 175 | return this->geometry_curves.size(); 176 | } 177 | 178 | ALWAYS_INLINE Integer NbSurfaces() 179 | { 180 | return this->geometry_surfaces.size(); 181 | } 182 | 183 | void ComputeProjectionCriteria(); 184 | DirichletData GetDirichletData(); 185 | 186 | 187 | std::string mesh_element_type; 188 | UInteger ndim; 189 | Real scale; 190 | Real condition; 191 | Real projection_precision; 192 | Eigen::MatrixUI mesh_elements; 193 | Eigen::MatrixR mesh_points; 194 | Eigen::MatrixUI mesh_edges; 195 | Eigen::MatrixUI mesh_faces; 196 | Eigen::MatrixUI projection_criteria; 197 | 198 | UInteger degree; 199 | TopoDS_Shape imported_shape; 200 | UInteger no_of_shapes; 201 | std::vector geometry_points; 202 | std::vector geometry_curves; 203 | std::vector geometry_surfaces; 204 | std::vector> geometry_surfaces_curves; 205 | std::vector geometry_curves_types; 206 | std::vector geometry_surfaces_types; 207 | std::vector> geometry_surfaces_curves_types; 208 | std::vector topo_edges; 209 | std::vector topo_faces; 210 | Eigen::MatrixR displacements_BC; 211 | Eigen::MatrixI index_nodes; 212 | Eigen::MatrixUI nodes_dir; 213 | Eigen::MatrixR fekete; 214 | 215 | 216 | private: 217 | void SetDimension(const UInteger &dim) 218 | { 219 | this->ndim=dim; 220 | } 221 | 222 | void SetMeshElementType(std::string &type) 223 | { 224 | this->mesh_element_type = type; 225 | } 226 | }; 227 | 228 | #endif // POSTMESHBASE 229 | -------------------------------------------------------------------------------- /include/PostMeshCurve.hpp: -------------------------------------------------------------------------------- 1 | #ifndef PostMeshCurve_HPP 2 | #define PostMeshCurve_HPP 3 | 4 | #include 5 | 6 | 7 | // BASE CLASS FOR OPENCASCADE FRONT-END 8 | class PostMeshCurve: public PostMeshBase 9 | { 10 | 11 | public: 12 | 13 | ALWAYS_INLINE PostMeshCurve() : PostMeshBase() 14 | { 15 | this->ndim = 2; 16 | this->mesh_element_type = "tri"; 17 | } 18 | 19 | ALWAYS_INLINE PostMeshCurve(std::string &element_type, const UInteger &dim) \ 20 | : PostMeshBase(element_type,dim){} 21 | 22 | PostMeshCurve(const PostMeshCurve& other) \ 23 | noexcept(std::is_copy_constructible::value); 24 | PostMeshCurve& operator=(const PostMeshCurve& other) \ 25 | noexcept(std::is_copy_assignable::value); 26 | PostMeshCurve(PostMeshCurve&& other) noexcept; 27 | PostMeshCurve& operator=(PostMeshCurve&& other) noexcept; 28 | ALWAYS_INLINE ~PostMeshCurve(){} 29 | 30 | ALWAYS_INLINE void Init() 31 | { 32 | this->mesh_element_type = "tri"; 33 | this->ndim = 2; 34 | this->scale = 1.0; 35 | this->condition = 1.0e10; 36 | this->projection_precision = 1.0e-4; 37 | } 38 | 39 | void InferInterpolationPolynomialDegree(); 40 | void CurvesToBsplineCurves(); 41 | void GetCurvesParameters(); 42 | void GetCurvesLengths(); 43 | std::vector > DiscretiseCurves(Integer npoints); 44 | void GetGeomPointsOnCorrespondingEdges(); 45 | void IdentifyCurvesContainingEdges(); 46 | void ProjectMeshOnCurve(); 47 | void RepairDualProjectedParameters(); 48 | void MeshPointInversionCurveArcLength(); 49 | void MeshPointInversionCurve(); 50 | void GetBoundaryPointsOrder(); 51 | 52 | 53 | // PUBLIC DATA MEMBERS OF PostMeshCurve 54 | std::vector geometry_points_on_curves; 55 | std::vector geometry_curves_bspline; 56 | Eigen::MatrixI boundary_points_order; 57 | Eigen::MatrixI boundary_edges_order; 58 | Eigen::MatrixR curve_to_parameter_scale_U; 59 | Eigen::MatrixR curves_parameters; 60 | Eigen::MatrixR curves_lengths; 61 | 62 | 63 | protected: 64 | void FindCurvesSequentiallity(); 65 | void ConcatenateSequentialCurves(); 66 | void GetInternalCurveScale(); 67 | Eigen::MatrixR ParametricFeketePoints(Standard_Real &u1, Standard_Real &u2); 68 | void GetElementsWithBoundaryEdgesTri(); 69 | void EstimatedParameterUOnMesh(); 70 | 71 | 72 | Eigen::MatrixR projection_U; 73 | Eigen::MatrixI sorted_projected_indices; 74 | Eigen::MatrixI dirichlet_edges; 75 | std::vector listedges; 76 | Standard_Integer no_dir_edges; 77 | Eigen::MatrixR u_of_all_fekete_mesh_edges; 78 | Eigen::MatrixI elements_with_boundary_edges; 79 | }; 80 | 81 | 82 | #endif // PostMeshCurve_HPP 83 | -------------------------------------------------------------------------------- /include/PostMeshSurface.hpp: -------------------------------------------------------------------------------- 1 | #ifndef POSTMESHSURFACE_H 2 | #define POSTMESHSURFACE_H 3 | 4 | #include 5 | #include 6 | 7 | class PostMeshSurface: public PostMeshBase 8 | { 9 | 10 | public: 11 | PostMeshSurface() : PostMeshBase() 12 | { 13 | this->ndim = 3; 14 | this->mesh_element_type = "tet"; 15 | } 16 | 17 | PostMeshSurface(std::string &element_type, const UInteger &dim) : \ 18 | PostMeshBase(element_type,dim){} 19 | 20 | PostMeshSurface(const PostMeshSurface& other) \ 21 | noexcept(std::is_copy_constructible::value); 22 | PostMeshSurface& operator=(const PostMeshSurface& other) \ 23 | noexcept(std::is_copy_assignable::value); 24 | PostMeshSurface(PostMeshSurface&& other) noexcept; 25 | PostMeshSurface& operator=(PostMeshSurface&& other) noexcept; 26 | ~PostMeshSurface(){} 27 | 28 | ALWAYS_INLINE void Init() 29 | { 30 | this->ndim = 3; 31 | this->mesh_element_type = "tet"; 32 | this->scale = 1.0; 33 | this->condition = 1.0e10; 34 | } 35 | 36 | void InferInterpolationPolynomialDegree(); 37 | void SurfacesToBsplineSurfaces(); 38 | void GetSurfacesParameters(); 39 | void GetGeomPointsOnCorrespondingFaces(); 40 | void IdentifySurfacesContainingFacesByPureProjection(Integer activate_bounding_box=0, Real bb_tolerance=1e-3); 41 | void IdentifyRemainingSurfacesByProjection(Integer activate_bounding_box=0); 42 | void IdentifySurfacesContainingFaces(Integer activate_bounding_box=0, Real bb_tolerance=1e-3); 43 | void SupplySurfacesContainingFaces(const Integer *arr, Integer rows, Integer already_mapped = 0, Integer caller = 0); 44 | void IdentifySurfacesIntersections(); 45 | void ProjectMeshOnSurface(); 46 | void RepairDualProjectedParameters(); 47 | void MeshPointInversionCurve(const gp_Pnt &point_in, gp_Pnt &point_out, Integer id_surface=-1); 48 | void MeshPointInversionSurface(Integer project_on_curves, Integer modify_linear_mesh = 0); 49 | void MeshPointInversionSurfaceArcLength(Integer project_on_curves, Real OrthTol, Real *FEbases, Integer rows, Integer cols); 50 | void GetBoundaryPointsOrder(); 51 | void GetBoundingBoxOnSurfaces(Real bb_tolerance=1e-3); 52 | std::vector< std::vector > GetMeshFacesOnPlanarSurfaces(); 53 | std::vector GetDirichletFaces(); 54 | 55 | 56 | std::vector geometry_points_on_surfaces; 57 | std::vector geometry_surfaces_bspline; 58 | Eigen::MatrixI boundary_faces_order; 59 | Eigen::MatrixR surfaces_Uparameters; 60 | Eigen::MatrixR surfaces_Vparameters; 61 | Eigen::MatrixR bbox_surfaces; 62 | 63 | protected: 64 | 65 | Eigen::MatrixI projection_ID; 66 | Eigen::MatrixR projection_U; 67 | Eigen::MatrixR projection_V; 68 | Eigen::MatrixI sorted_projected_indicesU; 69 | Eigen::MatrixI sorted_projected_indicesV; 70 | Eigen::MatrixI dirichlet_faces; 71 | std::vector listfaces; 72 | Integer no_dir_faces; 73 | Eigen::MatrixI elements_with_boundary_faces; 74 | Eigen::MatrixI curve_surface_projection_flags; 75 | 76 | ALWAYS_INLINE Integer GetNoFaceVertices() { 77 | if (mesh_element_type=="tet") { 78 | return 3; 79 | } 80 | else if (mesh_element_type == "hex") { 81 | return 4; 82 | } 83 | else { 84 | throw std::runtime_error(std::string("Element type not understood")); 85 | return -1; 86 | } 87 | } 88 | std::vector FindPlanarSurfaces(); 89 | }; 90 | 91 | #endif // POSTMESHSURFACE_H 92 | -------------------------------------------------------------------------------- /include/PyInterface.hpp: -------------------------------------------------------------------------------- 1 | #ifndef PYINTERFACE_HPP 2 | #define PYINTERFACE_HPP 3 | 4 | #include 5 | 6 | // DirichletData STRUCTURE - FOR THE PURPOSE OF PASSING TO PYTHON 7 | struct DirichletData 8 | { 9 | std::vector displacement_BC_stl; 10 | std::vector nodes_dir_out_stl; 11 | Integer nodes_dir_size; 12 | }; 13 | 14 | #endif // PYINTERFACE_HPP 15 | 16 | -------------------------------------------------------------------------------- /include/PyInterfaceEmulator.hpp: -------------------------------------------------------------------------------- 1 | #ifndef PYTHONINTERFACE_HPP 2 | #define PYTHONINTERFACE_HPP 3 | 4 | #include 5 | 6 | DirichletData ComputeDirichleteData(const char *iges_filename, Real scale, Real* points_array, const Integer points_rows, const Integer points_cols, 7 | UInteger *elements_array, const Integer element_rows, const Integer element_cols, 8 | UInteger *edges_array, const Integer &edges_rows, const Integer &edges_cols, 9 | UInteger *faces_array, const Integer &faces_rows, const Integer &faces_cols, Real condition, 10 | Real *boundary_fekete, const Integer fekete_rows, const Integer fekete_cols, 11 | UInteger *criteria, const Integer criteria_rows, const Integer criteria_cols, const Real &precision); 12 | 13 | DirichletData ComputeDirichleteData3D(const char *iges_filename, Real scale, Real* points_array, const Integer points_rows, const Integer points_cols, 14 | UInteger *elements_array, const Integer element_rows, const Integer element_cols, 15 | UInteger *edges_array, const Integer &edges_rows, const Integer &edges_cols, 16 | UInteger *faces_array, const Integer &faces_rows, const Integer &faces_cols, Real condition, 17 | Real *boundary_fekete, const Integer fekete_rows, const Integer fekete_cols, 18 | UInteger *criteria, const Integer criteria_rows, const Integer criteria_cols, const Real &precision); 19 | 20 | 21 | #endif // PYTHONINTERFACE_HPP 22 | 23 | -------------------------------------------------------------------------------- /include/STL_INC.hpp: -------------------------------------------------------------------------------- 1 | #ifndef STD_INC_HPP 2 | #define STD_INC_HPP 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #ifdef WINDOWS 25 | #include 26 | #define GetCurrentDir _getcwd 27 | #else 28 | #include 29 | #define GetCurrentDir getcwd 30 | #endif 31 | 32 | 33 | 34 | typedef long long Integer; 35 | typedef unsigned long long UInteger; 36 | typedef double Real; 37 | typedef bool Boolean; 38 | 39 | #define False false 40 | #define True true 41 | 42 | 43 | // CONTROL FUNCTION INLINING 44 | #if defined(__GNUC__) || defined(__GNUG__) 45 | #define ALWAYS_INLINE inline __attribute__((always_inline)) 46 | #define NEVER_INLINE __attribute__((noinline)) 47 | #elif defined(_MSC_VER) 48 | #define ALWAYS_INLINE __forceinline 49 | #define NEVER_INLINE __declspec(noinline) 50 | #endif 51 | 52 | #define STATIC static 53 | 54 | #define INF std::numeric_limits::infinity() 55 | 56 | #endif // STD_INC_HPP 57 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup 2 | from setuptools import find_packages 3 | from distutils.command.clean import clean 4 | from distutils.extension import Extension 5 | from distutils.sysconfig import get_config_vars 6 | from Cython.Build import cythonize 7 | import os, platform, sys, fnmatch 8 | import numpy 9 | 10 | 11 | def setup_package(): 12 | 13 | # Get Platform/OS 14 | _os = sys.platform 15 | 16 | # Get the current directory 17 | _pwd_ = os.path.dirname(os.path.realpath('__file__')) 18 | _upwd_ = os.path.dirname(_pwd_) 19 | 20 | # Remove the "-Wstrict-prototypes" compiler option, which isn't valid for C++. 21 | cfg_vars = get_config_vars() 22 | for key, value in cfg_vars.items(): 23 | if isinstance(value,str): 24 | cfg_vars[key] = value.replace("-Wstrict-prototypes", "") 25 | 26 | # Suppress numpy deprecation warnings 27 | no_deprecated = ("NPY_NO_DEPRECATED_API",None) 28 | 29 | sourcefiles = [ 30 | os.path.join(_pwd_,"bindings","PostMeshPy.pyx"), 31 | os.path.join(_pwd_,"src","PostMeshBase.cpp"), 32 | os.path.join(_pwd_,"src","PostMeshCurve.cpp"), 33 | os.path.join(_pwd_,"src","PostMeshSurface.cpp") 34 | ] 35 | 36 | 37 | # Set the compiler 38 | # Must be called as: "python setup.py build_ext CXX=/usr/bin/g++" 39 | args = sys.argv 40 | _cxx_specified = False 41 | if len(args) > 1: 42 | for counter, arg in enumerate(args): 43 | if "CXX" in arg: 44 | _cxx_specified = True 45 | _cxx_compiler = arg.split("=")[-1] 46 | args.remove(arg) 47 | if _cxx_specified: 48 | os.environ["CC"] = _cxx_compiler 49 | os.environ["CXX"] = _cxx_compiler 50 | else: 51 | _cxx_compiler = get_config_vars()['CXX'].split(' ')[0] 52 | os.environ["CC"] = _cxx_compiler 53 | os.environ["CXX"] = _cxx_compiler 54 | 55 | 56 | # Compiler arguments 57 | if "clang++" in _cxx_compiler or ("c++" in _cxx_compiler and "darwin" in _os): 58 | compiler_args = ["-O3","-std=c++11","-m64","-march=native","-mtune=native","-ffp-contract=fast", 59 | "-ffast-math","-flto","-DNPY_NO_DEPRECATED_API","-Wno-shorten-64-to-32"] 60 | else: 61 | compiler_args = ["-O3","-std=c++11","-m64","-march=native","-mtune=native","-ffp-contract=fast", 62 | "-mfpmath=sse","-ffast-math","-ftree-vectorize","-finline-functions","-finline-limit=100000", 63 | "-funroll-loops","-Wno-unused-function","-flto","-DNPY_NO_DEPRECATED_API","-Wno-cpp"] 64 | 65 | # if "darwin" in _os: 66 | # compiler_args.append("-stdlib=libstdc++") 67 | 68 | 69 | eigen_include_path = "/usr/local/include/eigen/" 70 | oce_include_path = "/usr/local/include/oce/" 71 | 72 | 73 | # Link to OpenCascade runtime libraries 74 | # Search for all subdirectories under /usr/local/lib 75 | # Change the directory name if occ is elsewhere 76 | occ_dir = "/usr/local/lib" 77 | all_dir_libs = os.listdir(occ_dir) 78 | occ_libs = [] 79 | for i in all_dir_libs: 80 | lib_suffix = i.split(".")[-1] 81 | if i[:4]=="libT" and (lib_suffix != "a" and lib_suffix != "la" and lib_suffix != "0"): 82 | if "darwin" in _os: 83 | occ_libs.append(i[3:-6]) 84 | elif "linux" in _os: 85 | occ_libs.append(":"+i) 86 | 87 | found_oce = False 88 | for i in occ_libs: 89 | if "TKernel" in i: 90 | found_oce = True 91 | break 92 | 93 | 94 | if found_oce is False: 95 | if "darwin" in _os: 96 | version = next(os.walk("/usr/local/Cellar/oce/"))[1][0] 97 | occ_dir = os.path.join("/usr/local/Cellar/oce",version,"lib") 98 | oce_include_path = os.path.join("/usr/local/Cellar/oce",version,"include","oce") 99 | elif "linux" in _os: 100 | occ_dir = "/usr/lib/x86_64-linux-gnu" 101 | oce_include_path = "/usr/include/oce/" 102 | 103 | all_dir_libs = os.listdir(occ_dir) 104 | for i in all_dir_libs: 105 | lib_suffix = i.split(".")[-1] 106 | if i[:4]=="libT" and (lib_suffix != "a" and lib_suffix != "la" and lib_suffix != "0"): 107 | occ_libs.append(":"+i) 108 | 109 | 110 | # Create extension module 111 | extensions = [ 112 | Extension( 113 | name = "PostMeshPy", 114 | sources = sourcefiles, 115 | language="c++", 116 | include_dirs = [_pwd_, 117 | _pwd_+"/include/", 118 | eigen_include_path, 119 | oce_include_path, 120 | numpy.get_include()], 121 | libraries= ["stdc++"] + occ_libs, 122 | library_dirs = [_pwd_, os.path.join("/usr","local","lib")], 123 | extra_compile_args = compiler_args, 124 | define_macros=[no_deprecated], 125 | ), 126 | ] 127 | 128 | with open("README.md", "r") as fh: 129 | long_description = fh.read() 130 | 131 | setup( 132 | ext_modules = cythonize(extensions), 133 | name = "PostMeshPy", 134 | version = "1.6.1", 135 | description = "A Python wrapper for PostMesh - a high order curvilinear mesh generator based on OpenCascade", 136 | long_description=long_description, 137 | long_description_content_type="text/markdown", 138 | author="Roman Poya", 139 | author_email = "roman_poya@yahoo.com", 140 | url = "https://github.com/romeric/PostMesh", 141 | license="MIT", 142 | install_requires=[ 143 | 'numpy>=1.9', 144 | 'cython>=0.23'], 145 | packages=find_packages(), 146 | include_package_data=True, 147 | package_data={'': ['bindings/*','src/*','include/*','example/*', 148 | '*.pyx', '*.pxd', '*.h', '*.hpp', '*.c', '*.cpp', 'Makefile']}, 149 | extra_files = "LICENSE.md" 150 | ) 151 | 152 | 153 | if __name__ == "__main__": 154 | setup_package() 155 | -------------------------------------------------------------------------------- /src/PostMeshBase.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | PostMeshBase::PostMeshBase(const PostMeshBase& other) \ 5 | noexcept(std::is_copy_constructible::value): \ 6 | scale(other.scale), condition(other.condition), \ 7 | projection_precision(other.projection_precision) 8 | { 9 | // COPY CONSTRUCTOR 10 | this->mesh_element_type = other.mesh_element_type; 11 | this->ndim = other.ndim; 12 | this->mesh_elements = other.mesh_elements; 13 | this->mesh_points = other.mesh_points; 14 | this->mesh_edges = other.mesh_edges; 15 | this->mesh_faces = other.mesh_faces; 16 | this->projection_criteria = other.projection_criteria; 17 | this->degree = other.degree; 18 | this->imported_shape = other.imported_shape; 19 | this->no_of_shapes = other.no_of_shapes; 20 | this->geometry_points = other.geometry_points; 21 | this->geometry_curves = other.geometry_curves; 22 | this->geometry_surfaces = other.geometry_surfaces; 23 | this->geometry_curves_types = other.geometry_curves_types; 24 | this->geometry_surfaces_types = other.geometry_surfaces_types; 25 | this->displacements_BC = other.displacements_BC; 26 | this->index_nodes = other.index_nodes; 27 | this->nodes_dir = other.nodes_dir; 28 | this->fekete = other.fekete; 29 | } 30 | 31 | PostMeshBase& PostMeshBase::operator=(const PostMeshBase& other) \ 32 | noexcept(std::is_copy_assignable::value) 33 | { 34 | // COPY ASSIGNMENT OPERATOR 35 | this->scale = other.scale; 36 | this->condition = other.condition; 37 | this->projection_precision = other.projection_precision; 38 | 39 | this->mesh_element_type = other.mesh_element_type; 40 | this->ndim = other.ndim; 41 | this->mesh_elements = other.mesh_elements; 42 | this->mesh_points = other.mesh_points; 43 | this->mesh_edges = other.mesh_edges; 44 | this->mesh_faces = other.mesh_faces; 45 | this->projection_criteria = other.projection_criteria; 46 | this->degree = other.degree; 47 | this->imported_shape = other.imported_shape; 48 | this->no_of_shapes = other.no_of_shapes; 49 | this->geometry_points = other.geometry_points; 50 | this->geometry_curves = other.geometry_curves; 51 | this->geometry_surfaces = other.geometry_surfaces; 52 | this->geometry_curves_types = other.geometry_curves_types; 53 | this->geometry_surfaces_types = other.geometry_surfaces_types; 54 | this->displacements_BC = other.displacements_BC; 55 | this->index_nodes = other.index_nodes; 56 | this->nodes_dir = other.nodes_dir; 57 | this->fekete = other.fekete; 58 | 59 | return *this; 60 | } 61 | 62 | PostMeshBase::PostMeshBase(PostMeshBase&& other) noexcept : \ 63 | scale(other.scale), condition(other.condition), \ 64 | projection_precision(other.projection_precision) 65 | { 66 | // MOVE CONSTRUCTOR 67 | this->mesh_element_type = other.mesh_element_type; 68 | this->ndim = other.ndim; 69 | this->mesh_elements = std::move(other.mesh_elements); 70 | this->mesh_points = std::move(other.mesh_points); 71 | this->mesh_edges = std::move(other.mesh_edges); 72 | this->mesh_faces = std::move(other.mesh_faces); 73 | this->projection_criteria = std::move(other.projection_criteria); 74 | this->degree = other.degree; 75 | this->imported_shape = std::move(other.imported_shape); 76 | this->no_of_shapes = other.no_of_shapes; 77 | this->geometry_points = std::move(other.geometry_points); 78 | this->geometry_curves = std::move(other.geometry_curves); 79 | this->geometry_surfaces = std::move(other.geometry_surfaces); 80 | this->geometry_curves_types = std::move(other.geometry_curves_types); 81 | this->geometry_surfaces_types = std::move(other.geometry_surfaces_types); 82 | this->displacements_BC = std::move(other.displacements_BC); 83 | this->index_nodes = std::move(other.index_nodes); 84 | this->nodes_dir = std::move(other.nodes_dir); 85 | this->fekete = std::move(other.fekete); 86 | 87 | //! NB: CHECK THAT YOUR VERSION OF EIGEN SUPPORTS RVALUE REFERENCES 88 | //! (EIGEN_HAVE_RVALUE_REFERENCES). In PostMesh this is activated by default. 89 | //! ACTIVATING/DEACTIVATING DOES NOT AFFECT THE CODE IN ANY WAY COMPATIBILITY-WISE 90 | //! AS THEN THE COPY CONSTRUCTOR WOULD KICK IN INSTEAD OF MOVE CONSTRUCTOR 91 | } 92 | 93 | PostMeshBase& PostMeshBase::operator=(PostMeshBase&& other) noexcept 94 | { 95 | // MOVE ASSIGNMENT OPERATOR 96 | this->scale = other.scale; 97 | this->condition = other.condition; 98 | this->projection_precision = other.projection_precision; 99 | 100 | this->mesh_element_type = other.mesh_element_type; 101 | this->ndim = other.ndim; 102 | this->mesh_elements = std::move(other.mesh_elements); 103 | this->mesh_points = std::move(other.mesh_points); 104 | this->mesh_edges = std::move(other.mesh_edges); 105 | this->mesh_faces = std::move(other.mesh_faces); 106 | this->projection_criteria = std::move(other.projection_criteria); 107 | this->degree = other.degree; 108 | this->imported_shape = std::move(other.imported_shape); 109 | this->no_of_shapes = other.no_of_shapes; 110 | this->geometry_points = std::move(other.geometry_points); 111 | this->geometry_curves = std::move(other.geometry_curves); 112 | this->geometry_surfaces = std::move(other.geometry_surfaces); 113 | this->geometry_curves_types = std::move(other.geometry_curves_types); 114 | this->geometry_surfaces_types = std::move(other.geometry_surfaces_types); 115 | this->displacements_BC = std::move(other.displacements_BC); 116 | this->index_nodes = std::move(other.index_nodes); 117 | this->nodes_dir = std::move(other.nodes_dir); 118 | this->fekete = std::move(other.fekete); 119 | 120 | //! NB: CHECK THAT YOUR VERSION OF EIGEN SUPPORTS RVALUE REFERENCES 121 | //! (EIGEN_HAVE_RVALUE_REFERENCES). In PostMesh this is activated by default. 122 | //! ACTIVATING/DEACTIVATING DOES NOT AFFECT THE CODE IN ANY WAY COMPATIBILITY-WISE 123 | //! AS THEN THE COPY CONSTRUCTOR WOULD KICK IN INSTEAD OF MOVE CONSTRUCTOR 124 | 125 | return *this; 126 | } 127 | 128 | 129 | 130 | void PostMeshBase::ReadIGES(const char* filename) 131 | { 132 | //! IGES FILE READER BASED ON OCC BACKEND 133 | //! THIS FUNCTION CAN BE EXPANDED FURTHER TO TAKE CURVE/SURFACE CONSISTENY INTO ACCOUNT 134 | //! http://www.opencascade.org/doc/occt-6.7.0/overview/html/user_guides__iges.html 135 | 136 | IGESControl_Reader reader; 137 | reader.ReadFile(filename); 138 | // CHECK FOR IMPORT STATUS 139 | reader.PrintCheckLoad(Standard_True,IFSelect_GeneralInfo); 140 | reader.PrintCheckTransfer(Standard_True,IFSelect_ItemsByEntity); 141 | // READ IGES FILE AS-IS 142 | Interface_Static::SetIVal("read.iges.bspline.continuity",0); 143 | Standard_Integer ic = Interface_Static::IVal("read.iges.bspline.continuity"); 144 | if (ic !=0) 145 | { 146 | std::cerr << "IGES file was not read as-is. The file was not read/transformed correctly\n"; 147 | } 148 | 149 | // FORCE UNITS (NONE SEEM TO WORK) 150 | //Interface_Static::SetIVal("xstep.cascade.unit",0); 151 | //Interface_Static::SetIVal("read.scale.unit",0); 152 | 153 | // IF ALL OKAY, THEN TRANSFER ROOTS 154 | reader.TransferRoots(); 155 | 156 | this->imported_shape = reader.OneShape(); 157 | this->no_of_shapes = reader.NbShapes(); 158 | } 159 | 160 | void PostMeshBase::ReadSTEP(const char* filename) 161 | { 162 | //! IGES FILE READER BASED ON OCC BACKEND 163 | //! THIS FUNCTION CAN BE EXPANDED FURTHER TO TAKE CURVE/SURFACE CONSISTENY INTO ACCOUNT 164 | //! http://www.opencascade.org/doc/occt-6.7.0/overview/html/user_guides__iges.html 165 | 166 | STEPControl_Reader reader; 167 | reader.ReadFile(filename); 168 | // CHECK FOR IMPORT STATUS 169 | reader.PrintCheckLoad(Standard_True,IFSelect_GeneralInfo); 170 | reader.PrintCheckTransfer(Standard_True,IFSelect_ItemsByEntity); 171 | // READ IGES FILE AS-IS 172 | Interface_Static::SetIVal("read.iges.bspline.continuity",0); 173 | Standard_Integer ic = Interface_Static::IVal("read.iges.bspline.continuity"); 174 | if (ic !=0) 175 | { 176 | std::cerr << "STEP file was not read as-is. The file was not read/transformed correctly\n"; 177 | } 178 | 179 | // FORCE UNITS (NONE SEEM TO WORK) 180 | //Interface_Static::SetIVal("xstep.cascade.unit",0); 181 | //Interface_Static::SetIVal("read.scale.unit",0); 182 | 183 | // IF ALL OKAY, THEN TRANSFER ROOTS 184 | reader.TransferRoots(); 185 | 186 | this->imported_shape = reader.OneShape(); 187 | this->no_of_shapes = reader.NbShapes(); 188 | 189 | //auto edges = reader.GiveList("iges-faces"); 190 | 191 | } 192 | 193 | Eigen::MatrixI PostMeshBase::Read(std::string &filename) 194 | { 195 | //! Reading 1D integer arrays 196 | std::vector arr; 197 | arr.clear(); 198 | std::string temp; 199 | 200 | std::ifstream datafile; 201 | datafile.open(filename.c_str()); 202 | 203 | if(!datafile) 204 | { 205 | warn("Unable to read file"); 206 | } 207 | while(datafile) 208 | { 209 | datafile >> temp; 210 | temp += ""; 211 | arr.push_back(temp); 212 | } 213 | 214 | datafile.close(); 215 | 216 | const Integer rows = arr.size(); 217 | const Integer cols = 1; 218 | 219 | Eigen::MatrixI out_arr = Eigen::MatrixI::Zero(rows,cols); 220 | 221 | for(Integer i=0 ; i arr; 239 | arr.clear(); 240 | std::string temp; 241 | 242 | std::ifstream datafile; 243 | datafile.open(filename.c_str()); 244 | 245 | if(!datafile) 246 | { 247 | warn("Unable to read file"); 248 | } 249 | while(datafile) 250 | { 251 | datafile >> temp; 252 | temp += ""; 253 | arr.push_back(temp); 254 | } 255 | 256 | datafile.close(); 257 | 258 | 259 | const Integer rows = arr.size(); 260 | const Integer cols = (split(arr[0], delim)).size(); 261 | 262 | 263 | Eigen::MatrixUI out_arr = Eigen::MatrixUI::Zero(rows,cols); 264 | 265 | for(Integer i=0 ; i elems; 268 | elems = split(arr[i], delim); 269 | for(Integer j=0 ; j arr; 300 | arr.clear(); 301 | std::string temp; 302 | 303 | std::ifstream datafile; 304 | datafile.open(filename.c_str()); 305 | 306 | if(!datafile) 307 | { 308 | warn("Unable to read file"); 309 | } 310 | while(datafile) 311 | { 312 | datafile >> temp; 313 | temp += ""; 314 | arr.push_back(temp); 315 | } 316 | 317 | datafile.close(); 318 | 319 | 320 | const Integer rows = arr.size(); 321 | const Integer cols = (split(arr[0], delim)).size(); 322 | 323 | 324 | Eigen::MatrixR out_arr = Eigen::MatrixR::Zero(rows,cols); 325 | 326 | for(Integer i=0 ; i elems; 329 | elems = split(arr[i], delim); 330 | for(Integer j=0 ; jmesh_points.rows()-2; imesh_points.rows();i++) 365 | { 366 | check_duplicated_rows = (this->mesh_points.row(i) - this->mesh_points.row(i-1)).norm(); 367 | if (std::abs(check_duplicated_rows) < 1.0e-14) 368 | { 369 | flag_p = 1; 370 | } 371 | } 372 | if (flag_p == 1) 373 | { 374 | Eigen::MatrixI a_rows = cnp::arange(Integer(this->mesh_points.rows()-1)); 375 | Eigen::MatrixI a_cols = cnp::arange(Integer(this->mesh_points.cols())); 376 | this->mesh_points = cnp::take(this->mesh_points,a_rows,a_cols); 377 | } 378 | 379 | // ELEMENTS 380 | int flag_e = 0; 381 | for (int i=this->mesh_elements.rows()-2; imesh_elements.rows();i++) 382 | { 383 | check_duplicated_rows = (this->mesh_elements.row(i) - this->mesh_elements.row(i-1)).norm(); 384 | if (std::abs(check_duplicated_rows) < 1.0e-14) 385 | { 386 | flag_e = 1; 387 | } 388 | } 389 | if (flag_e == 1) 390 | { 391 | Eigen::MatrixI a_rows = cnp::arange(Integer(this->mesh_elements.rows()-1)); 392 | Eigen::MatrixI a_cols = cnp::arange(Integer(this->mesh_elements.cols())); 393 | this->mesh_elements = cnp::take(this->mesh_elements,a_rows,a_cols); 394 | } 395 | 396 | // EDGES 397 | int flag_ed = 0; 398 | for (Integer i=this->mesh_edges.rows()-2; imesh_edges.rows();i++) 399 | { 400 | check_duplicated_rows = (this->mesh_edges.row(i) - this->mesh_edges.row(i-1)).norm(); 401 | if (std::abs(check_duplicated_rows) < 1.0e-14) 402 | { 403 | flag_ed = 1; 404 | } 405 | } 406 | if (flag_ed == 1) 407 | { 408 | Eigen::MatrixI a_rows = cnp::arange(Integer(this->mesh_edges.rows()-1)); 409 | Eigen::MatrixI a_cols = cnp::arange(Integer(this->mesh_edges.cols())); 410 | this->mesh_edges = cnp::take(this->mesh_edges,a_rows,a_cols); 411 | } 412 | 413 | // FACES FOR 3D 414 | if (this->mesh_faces.cols()!=0) 415 | { 416 | Integer flag_f = 0; 417 | for (Integer i=this->mesh_faces.rows()-2; imesh_faces.rows();i++) 418 | { 419 | check_duplicated_rows = (this->mesh_faces.row(i) - this->mesh_faces.row(i-1)).norm(); 420 | if (std::abs(check_duplicated_rows) < 1.0e-14) 421 | { 422 | flag_f = 1; 423 | } 424 | } 425 | if (flag_f == 1) 426 | { 427 | Eigen::MatrixI a_rows = cnp::arange(Integer(this->mesh_faces.rows()-1)); 428 | Eigen::MatrixI a_cols = cnp::arange(Integer(this->mesh_faces.cols())); 429 | this->mesh_faces = cnp::take(this->mesh_faces,a_rows,a_cols); 430 | } 431 | } 432 | 433 | Integer maxelem = this->mesh_elements.maxCoeff(); 434 | Integer maxpoint = this->mesh_points.rows(); 435 | 436 | if (maxelem+1 != maxpoint) 437 | { 438 | throw std::invalid_argument("Element connectivity and nodal coordinates do not match. This can be " 439 | "caused by giving two files which do not correspond to each other"); 440 | } 441 | 442 | std::cout << "All good with imported mesh. proceeding..." << std::endl; 443 | 444 | } 445 | 446 | void PostMeshBase::GetGeomVertices() 447 | { 448 | if (!this->geometry_points.empty()) 449 | return; 450 | 451 | for (TopExp_Explorer explorer(this->imported_shape,TopAbs_VERTEX); explorer.More(); explorer.Next()) 452 | { 453 | // GET THE VERTICES LYING ON THE IMPORTED TOPOLOGICAL SHAPE 454 | TopoDS_Vertex current_vertex = TopoDS::Vertex(explorer.Current()); 455 | gp_Pnt current_vertex_point = BRep_Tool::Pnt(current_vertex); 456 | 457 | this->geometry_points.push_back(current_vertex_point); 458 | } 459 | } 460 | 461 | void PostMeshBase::GetGeomEdges() 462 | { 463 | //! ITERATE OVER TopoDS_Shape AND EXTRACT ALL THE EDGES. CONVERT THE EDGES TO Geom_Curve AND 464 | //! GET THEIR HANDLES 465 | 466 | if (!this->geometry_curves.empty()) 467 | return; 468 | 469 | for (TopExp_Explorer explorer(this->imported_shape,TopAbs_EDGE); explorer.More(); explorer.Next()) 470 | { 471 | // GET THE EDGES 472 | TopoDS_Edge current_edge = TopoDS::Edge(explorer.Current()); 473 | // CONVERT THEM TO GEOM_CURVE 474 | Real first, last; 475 | Handle_Geom_Curve curve = BRep_Tool::Curve(current_edge,first,last); 476 | // STORE HANDLE IN THE CONTAINER 477 | this->geometry_curves.push_back(curve); 478 | 479 | // TO GET TYPE OF THE CURVE - UNLIKE GeomAdaptor_Curve, BRepAdaptor_Curve 480 | // DOES NOT THROW BUT RETURNS GeomAbs_OtherCurve FOR UNKNOWN TYPE OF CURVES 481 | BRepAdaptor_Curve adapt_curve(current_edge); 482 | // STORE TYPE OF CURVE (CURVE TYPES ARE DEFINED IN OCC_INC.hpp) 483 | this->geometry_curves_types.push_back(adapt_curve.GetType()); 484 | } 485 | 486 | 487 | // DETERMINE WHICH CURVES SET ON WHICH SURFACES 488 | for (TopExp_Explorer explorer(this->imported_shape,TopAbs_FACE); explorer.More(); explorer.Next()) 489 | { 490 | std::vector current_surface_curves; 491 | std::vector current_surface_curves_types; 492 | for (TopExp_Explorer explorer_edge(explorer.Current(),TopAbs_EDGE); explorer_edge.More(); explorer_edge.Next()) 493 | { 494 | // GET THE EDGES 495 | TopoDS_Edge current_edge = TopoDS::Edge(explorer_edge.Current()); 496 | // CONVERT THEM TO GEOM_CURVE 497 | Real first, last; 498 | Handle_Geom_Curve curve = BRep_Tool::Curve(current_edge,first,last); 499 | // STORE HANDLE IN THE CONTAINER 500 | current_surface_curves.push_back(curve); 501 | 502 | // TO GET TYPE OF THE CURVE - UNLIKE GeomAdaptor_Curve, BRepAdaptor_Curve 503 | // DOES NOT THROW BUT RETURNS GeomAbs_OtherCurve FOR UNKNOWN TYPE OF CURVES 504 | BRepAdaptor_Curve adapt_curve(current_edge); 505 | // STORE TYPE OF CURVE (CURVE TYPES ARE DEFINED IN OCC_INC.hpp) 506 | current_surface_curves_types.push_back(adapt_curve.GetType()); 507 | } 508 | this->geometry_surfaces_curves.push_back(current_surface_curves); 509 | this->geometry_surfaces_curves_types.push_back(current_surface_curves_types); 510 | } 511 | } 512 | 513 | void PostMeshBase::GetGeomFaces() 514 | { 515 | //! ITERATE OVER TopoDS_Shape AND EXTRACT ALL THE EDGES. CONVERT THE EDGES TO Geom_Surface AND 516 | //! GET THEIR HANDLES 517 | 518 | if (!this->geometry_surfaces.empty() && !this->topo_faces.empty()) 519 | return; 520 | 521 | for (TopExp_Explorer explorer(this->imported_shape,TopAbs_FACE); explorer.More(); explorer.Next()) 522 | { 523 | 524 | // GET THE FACES 525 | TopoDS_Face current_face = TopoDS::Face(explorer.Current()); 526 | // STORE 527 | this->topo_faces.push_back(current_face); 528 | // CONVERT THEM TO GEOM_SURFACE 529 | Handle_Geom_Surface surface = BRep_Tool::Surface(current_face); 530 | // STORE HANDLE IN THE CONTAINER 531 | this->geometry_surfaces.push_back(surface); 532 | 533 | // TO GET TYPE OF THE SURFACE. UNLIKE GeomAdaptor_Surface, BRepAdaptor_Surface 534 | // DOES NOT THROW BUT RETURNS GeomAbs_OtherSurface FOR UNKNOWN TYPE OF SURFACES 535 | BRepAdaptor_Surface adapt_surface(current_face); 536 | // STORE TYPE OF SURFACE (SURFACE TYPES ARE DEFINED IN OCC_INC.hpp) 537 | this->geometry_surfaces_types.push_back(adapt_surface.GetType()); 538 | 539 | } 540 | } 541 | 542 | std::vector PostMeshBase::ObtainGeomVertices() 543 | { 544 | std::vector geom_points; 545 | geom_points.clear(); 546 | // PASS TO CYTHON 547 | for (UInteger i=0; igeometry_points.size(); ++i) 548 | { 549 | geom_points.push_back(this->geometry_points[i].X()); 550 | geom_points.push_back(this->geometry_points[i].Y()); 551 | geom_points.push_back(this->geometry_points[i].Z()); 552 | } 553 | 554 | return geom_points; 555 | } 556 | 557 | void PostMeshBase::ComputeProjectionCriteria() 558 | { 559 | // IF NOT INITIALISED THEN COMPUTE 560 | assert((this->ndim==2 || this->ndim==3) && "Unknown number of dimensions"); 561 | 562 | if (this->projection_criteria.rows()==0) 563 | { 564 | this->projection_criteria.setZero(mesh_edges.rows(),mesh_edges.cols()); 565 | if (ndim==2) 566 | { 567 | for (Integer iedge=0; iedgemesh_points(this->mesh_edges(iedge,0),0); 571 | auto y1 = this->mesh_points(this->mesh_edges(iedge,0),1); 572 | auto x2 = this->mesh_points(this->mesh_edges(iedge,1),0); 573 | auto y2 = this->mesh_points(this->mesh_edges(iedge,1),1); 574 | 575 | // GET THE MIDDLE POINT OF THE EDGE 576 | auto x_avg = ( x1 + x2 )/2.; 577 | auto y_avg = ( y1 + y2 )/2.; 578 | 579 | auto cond = std::sqrt(x_avg*x_avg+y_avg*y_avg); 580 | 581 | if (condcondition) 582 | { 583 | projection_criteria(iedge)=1; 584 | } 585 | } 586 | } 587 | else if (ndim==3) 588 | { 589 | for (Integer iface=0; ifacemesh_faces.rows(); iface++) 590 | { 591 | // GET THE COORDINATES OF THE TWO END NODES 592 | auto x1 = this->mesh_points(this->mesh_faces(iface,0),0); 593 | auto y1 = this->mesh_points(this->mesh_faces(iface,0),1); 594 | auto z1 = this->mesh_points(this->mesh_faces(iface,0),2); 595 | auto x2 = this->mesh_points(this->mesh_faces(iface,1),0); 596 | auto y2 = this->mesh_points(this->mesh_faces(iface,1),1); 597 | auto z2 = this->mesh_points(this->mesh_faces(iface,1),2); 598 | auto x3 = this->mesh_points(this->mesh_faces(iface,2),0); 599 | auto y3 = this->mesh_points(this->mesh_faces(iface,2),1); 600 | auto z3 = this->mesh_points(this->mesh_faces(iface,2),2); 601 | 602 | auto x_avg = (x1 + x2 + x3 )/3.; 603 | auto y_avg = (y1 + y2 + y3 )/3.; 604 | auto z_avg = (z1 + z2 + z3 )/3.; 605 | 606 | auto cond = std::sqrt(x_avg*x_avg+y_avg*y_avg+z_avg*z_avg); 607 | 608 | if (condcondition) 609 | { 610 | projection_criteria(iface)=1; 611 | } 612 | } 613 | } 614 | } 615 | } 616 | 617 | DirichletData PostMeshBase::GetDirichletData() 618 | { 619 | // OBTAIN DIRICHLET DATA 620 | DirichletData Dirichlet_data; 621 | // CONVERT FROM EIGEN TO STL VECTOR 622 | std::vector nodes_Dirichlet_data_stl; 623 | nodes_Dirichlet_data_stl.assign(this->nodes_dir.data(),this->nodes_dir.data()+this->nodes_dir.rows()); 624 | // FIND UNIQUE VALUES OF DIRICHLET DATA 625 | std::vector idx; 626 | std::tie(std::ignore,idx) = cnp::unique(nodes_Dirichlet_data_stl,true); 627 | 628 | Dirichlet_data.nodes_dir_out_stl.resize(idx.size()); 629 | Dirichlet_data.displacement_BC_stl.resize(this->ndim*idx.size()); 630 | Dirichlet_data.nodes_dir_size = idx.size(); 631 | 632 | for (UInteger i=0; indim; ++j) 636 | { 637 | Dirichlet_data.displacement_BC_stl[this->ndim*i+j] = this->displacements_BC(idx[i],j); 638 | } 639 | } 640 | 641 | return Dirichlet_data; 642 | } 643 | --------------------------------------------------------------------------------