diff --git a/CMakeLists.txt b/CMakeLists.txt index 26ef5c6..d0d792e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,127 +1,127 @@ # required to specify the c++ standard cmake_minimum_required(VERSION 3.0) # required for install include(CMakePackageConfigHelpers) include(GNUInstallDirs) # project settings # ---------------- # name project(GooseFEM) # file that contains the version information -set(parse_version src/${PROJECT_NAME}/${PROJECT_NAME}.h) +set(parse_version include/${PROJECT_NAME}/${PROJECT_NAME}.h) # header files set(headers - src/GooseFEM/GooseFEM.h - src/GooseFEM/Mesh.hpp - src/GooseFEM/Mesh.h - src/GooseFEM/MeshTri3.hpp - src/GooseFEM/MeshTri3.h - src/GooseFEM/MeshQuad4.hpp - src/GooseFEM/MeshQuad4.h - src/GooseFEM/MeshHex8.hpp - src/GooseFEM/MeshHex8.h - src/GooseFEM/Element.hpp - src/GooseFEM/Element.h - src/GooseFEM/ElementQuad4.hpp - src/GooseFEM/ElementQuad4.h - src/GooseFEM/ElementHex8.hpp - src/GooseFEM/ElementHex8.h - src/GooseFEM/Vector.hpp - src/GooseFEM/Vector.h - src/GooseFEM/MatrixDiagonal.hpp - src/GooseFEM/MatrixDiagonal.h - src/GooseFEM/Iterate.hpp - src/GooseFEM/Iterate.h - src/GooseFEM/Dynamics.hpp - src/GooseFEM/Dynamics.h + include/GooseFEM/GooseFEM.h + include/GooseFEM/Mesh.hpp + include/GooseFEM/Mesh.h + include/GooseFEM/MeshTri3.hpp + include/GooseFEM/MeshTri3.h + include/GooseFEM/MeshQuad4.hpp + include/GooseFEM/MeshQuad4.h + include/GooseFEM/MeshHex8.hpp + include/GooseFEM/MeshHex8.h + include/GooseFEM/Element.hpp + include/GooseFEM/Element.h + include/GooseFEM/ElementQuad4.hpp + include/GooseFEM/ElementQuad4.h + include/GooseFEM/ElementHex8.hpp + include/GooseFEM/ElementHex8.h + include/GooseFEM/Vector.hpp + include/GooseFEM/Vector.h + include/GooseFEM/MatrixDiagonal.hpp + include/GooseFEM/MatrixDiagonal.h + include/GooseFEM/Iterate.hpp + include/GooseFEM/Iterate.h + include/GooseFEM/Dynamics.hpp + include/GooseFEM/Dynamics.h ) # automatically parse the version number file(READ "${parse_version}" version) string(REGEX MATCH "define[ \t]+GOOSEFEM_WORLD_VERSION[ \t]+([0-9]+)" _ "${version}") set(world_version "${CMAKE_MATCH_1}") string(REGEX MATCH "define[ \t]+GOOSEFEM_MAJOR_VERSION[ \t]+([0-9]+)" _ "${version}") set(major_version "${CMAKE_MATCH_1}") string(REGEX MATCH "define[ \t]+GOOSEFEM_MINOR_VERSION[ \t]+([0-9]+)" _ "${version}") set(minor_version "${CMAKE_MATCH_1}") set(GOOSEFEM_VERSION_NUMBER ${world_version}.${major_version}.${minor_version}) # paths # ----- set(GOOSEFEM_ROOT_DIR "${CMAKE_INSTALL_PREFIX}") set(GOOSEFEM_INCLUDE_DIR "${CMAKE_INSTALL_PREFIX}/${INCLUDE_INSTALL_DIR}") set(INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}") set(CMAKEPACKAGE_INSTALL_DIR "${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}") set(PKGCONFIG_INSTALL_DIR "${CMAKE_INSTALL_DATADIR}/pkgconfig") set(fcmake "${PROJECT_NAME}Config.cmake") set(fpkg "${PROJECT_NAME}.pc") # options # ------- # configure pkg-config (default: on) option(PKGCONFIG "Build pkg-config ${fpkg} file" ON) # disable pkg-config for native Windows builds if(WIN32 OR CMAKE_HOST_SYSTEM_NAME MATCHES Windows) option(PKGCONFIG "Build pkg-config ${fpkg} file" OFF) endif() # C++ standard # ------------ set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) if(NOT CMAKE_CXX_STANDARD OR CMAKE_CXX_STANDARD LESS 14) set(CMAKE_CXX_STANDARD 14) endif() # configure CMake # --------------- configure_package_config_file( ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}Config.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake PATH_VARS GOOSEFEM_INCLUDE_DIR GOOSEFEM_ROOT_DIR INSTALL_DESTINATION ${CMAKEPACKAGE_INSTALL_DIR} NO_CHECK_REQUIRED_COMPONENTS_MACRO ) # install # ------- # pkg-config if(PKGCONFIG) configure_file(${fpkg}.in ${fpkg} @ONLY) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${fpkg} DESTINATION ${PKGCONFIG_INSTALL_DIR}) endif() # CMake install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${fcmake} DESTINATION ${CMAKEPACKAGE_INSTALL_DIR}) # header files install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${headers} DESTINATION ${INCLUDE_INSTALL_DIR}) # print information to screen # --------------------------- message(STATUS "") message(STATUS "+---------------------------------------------------------------------------------") message(STATUS "|") message(STATUS "| Use 'make install' to install in") message(STATUS "| ${CMAKE_INSTALL_PREFIX}") message(STATUS "|") message(STATUS "| To specify a custom directory call") message(STATUS "| cmake /path/to/${PROJECT_NAME} -DCMAKE_INSTALL_PREFIX=yourprefix") message(STATUS "|") message(STATUS "| For custom paths, add the following line to your '~/.bashrc'") message(STATUS "| export PKG_CONFIG_PATH=${CMAKE_INSTALL_PREFIX}/share/pkgconfig:$PKG_CONFIG_PATH") message(STATUS "|") message(STATUS "+---------------------------------------------------------------------------------") message(STATUS "") diff --git a/src/GooseFEM/.gitignore b/include/GooseFEM/.gitignore similarity index 100% rename from src/GooseFEM/.gitignore rename to include/GooseFEM/.gitignore diff --git a/src/GooseFEM/Dynamics.h b/include/GooseFEM/Dynamics.h similarity index 100% rename from src/GooseFEM/Dynamics.h rename to include/GooseFEM/Dynamics.h diff --git a/src/GooseFEM/Dynamics.hpp b/include/GooseFEM/Dynamics.hpp similarity index 100% rename from src/GooseFEM/Dynamics.hpp rename to include/GooseFEM/Dynamics.hpp diff --git a/src/GooseFEM/Element.h b/include/GooseFEM/Element.h similarity index 100% rename from src/GooseFEM/Element.h rename to include/GooseFEM/Element.h diff --git a/src/GooseFEM/Element.hpp b/include/GooseFEM/Element.hpp similarity index 100% rename from src/GooseFEM/Element.hpp rename to include/GooseFEM/Element.hpp diff --git a/src/GooseFEM/ElementHex8.h b/include/GooseFEM/ElementHex8.h similarity index 100% rename from src/GooseFEM/ElementHex8.h rename to include/GooseFEM/ElementHex8.h diff --git a/src/GooseFEM/ElementHex8.hpp b/include/GooseFEM/ElementHex8.hpp similarity index 100% rename from src/GooseFEM/ElementHex8.hpp rename to include/GooseFEM/ElementHex8.hpp diff --git a/src/GooseFEM/ElementQuad4.h b/include/GooseFEM/ElementQuad4.h similarity index 100% rename from src/GooseFEM/ElementQuad4.h rename to include/GooseFEM/ElementQuad4.h diff --git a/src/GooseFEM/ElementQuad4.hpp b/include/GooseFEM/ElementQuad4.hpp similarity index 100% rename from src/GooseFEM/ElementQuad4.hpp rename to include/GooseFEM/ElementQuad4.hpp diff --git a/src/GooseFEM/GooseFEM.h b/include/GooseFEM/GooseFEM.h similarity index 97% rename from src/GooseFEM/GooseFEM.h rename to include/GooseFEM/GooseFEM.h index 3147355..0f86d0a 100644 --- a/src/GooseFEM/GooseFEM.h +++ b/include/GooseFEM/GooseFEM.h @@ -1,94 +1,94 @@ /* ================================================================================================= (c - GPLv3) T.W.J. de Geus (Tom) | tom@geus.me | www.geus.me | github.com/tdegeus/GooseFEM ================================================================================================= */ #ifndef GOOSEFEM_H #define GOOSEFEM_H // ================================================================================================= #define _USE_MATH_DEFINES // to use "M_PI" from "math.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace xt::placeholders; // ================================================================================================= #define GOOSEFEM_WORLD_VERSION 0 -#define GOOSEFEM_MAJOR_VERSION 0 -#define GOOSEFEM_MINOR_VERSION 11 +#define GOOSEFEM_MAJOR_VERSION 1 +#define GOOSEFEM_MINOR_VERSION 0 #define GOOSEFEM_VERSION_AT_LEAST(x,y,z) \ (GOOSEFEM_WORLD_VERSION>x || (GOOSEFEM_WORLD_VERSION>=x && \ (GOOSEFEM_MAJOR_VERSION>y || (GOOSEFEM_MAJOR_VERSION>=y && \ GOOSEFEM_MINOR_VERSION>=z)))) #define GOOSEFEM_VERSION(x,y,z) \ (GOOSEFEM_WORLD_VERSION==x && \ GOOSEFEM_MAJOR_VERSION==y && \ GOOSEFEM_MINOR_VERSION==z) // ================================================================================================= // dummy operation that can be use to suppress the "unused parameter" warnings #define UNUSED(p) ( (void)(p) ) // ================================================================================================= // alias Eigen sparse matrices namespace GooseFEM { typedef Eigen::SparseMatrix SpMatD; typedef Eigen::SparseMatrix SpMatS; } // ================================================================================================= #include "Mesh.h" #include "MeshTri3.h" #include "MeshQuad4.h" #include "MeshHex8.h" #include "Element.h" #include "ElementQuad4.h" #include "ElementHex8.h" #include "Vector.h" #include "MatrixDiagonal.h" #include "Iterate.h" #include "Dynamics.h" #include "Mesh.hpp" #include "MeshTri3.hpp" #include "MeshQuad4.hpp" #include "MeshHex8.hpp" #include "Element.hpp" #include "ElementQuad4.hpp" #include "ElementHex8.hpp" #include "Vector.hpp" #include "MatrixDiagonal.hpp" #include "Iterate.hpp" #include "Dynamics.hpp" // ================================================================================================= #endif diff --git a/src/GooseFEM/Iterate.h b/include/GooseFEM/Iterate.h similarity index 100% rename from src/GooseFEM/Iterate.h rename to include/GooseFEM/Iterate.h diff --git a/src/GooseFEM/Iterate.hpp b/include/GooseFEM/Iterate.hpp similarity index 100% rename from src/GooseFEM/Iterate.hpp rename to include/GooseFEM/Iterate.hpp diff --git a/src/GooseFEM/MatrixDiagonal.h b/include/GooseFEM/MatrixDiagonal.h similarity index 99% rename from src/GooseFEM/MatrixDiagonal.h rename to include/GooseFEM/MatrixDiagonal.h index 3f1ee57..a477bc7 100644 --- a/src/GooseFEM/MatrixDiagonal.h +++ b/include/GooseFEM/MatrixDiagonal.h @@ -1,137 +1,137 @@ /* ================================================================================================= (c - GPLv3) T.W.J. de Geus (Tom) | tom@geus.me | www.geus.me | github.com/tdegeus/GooseFEM ================================================================================================= */ #ifndef GOOSEFEM_MATRIXDIAGONAL_H #define GOOSEFEM_MATRIXDIAGONAL_H // ------------------------------------------------------------------------------------------------- #include "GooseFEM.h" // =========================================== GooseFEM ============================================ namespace GooseFEM { // ------------------------------------------------------------------------------------------------- class MatrixDiagonal { private: // data xt::xtensor m_data; // the diagonal matrix (not-partitioned) xt::xtensor m_inv; // inverse of "m_data", can be re-used to solve different right-hand-sides bool m_change=false; // signal changes to data compare to the last inverse // information xt::xtensor m_conn; // connectivity [nelem, nne ] xt::xtensor m_dofs; // DOF-numbers per node [nnode, ndim] xt::xtensor m_part; // DOF-numbers per node, after partitioning [nnode, ndim] xt::xtensor m_iiu; // DOF-numbers that are unknown [nnu] xt::xtensor m_iip; // DOF-numbers that are prescribed [nnp] // dimensions size_t m_nelem; // number of elements size_t m_nne; // number of nodes per element size_t m_nnode; // number of nodes size_t m_ndim; // number of dimensions size_t m_ndof; // number of DOFs size_t m_nnu; // number of unknown DOFs size_t m_nnp; // number of prescribed DOFs public: // constructor - MatrixDiagonal(){}; + MatrixDiagonal() = default; MatrixDiagonal(const xt::xtensor &conn, const xt::xtensor &dofs); MatrixDiagonal(const xt::xtensor &conn, const xt::xtensor &dofs, const xt::xtensor &iip); // index operators: access plain storage double& operator[](size_t i); const double& operator[](size_t i) const; // index operators: access using matrix indices double& operator()(size_t a); const double& operator()(size_t a) const; double& operator()(size_t a, size_t b); const double& operator()(size_t a, size_t b) const; // dimensions size_t nelem() const; // number of elements size_t nne() const; // number of nodes per element size_t nnode() const; // number of nodes size_t ndim() const; // number of dimensions size_t ndof() const; // number of DOFs size_t nnu() const; // number of unknown DOFs size_t nnp() const; // number of prescribed DOFs // DOF lists xt::xtensor iiu() const; // unknown DOFs xt::xtensor iip() const; // prescribed DOFs // product: c_i = A_ij * b_j xt::xtensor dot (const xt::xtensor &b ) const; // c = A * b xt::xtensor dot_u(const xt::xtensor &b ) const; // c_u = A_uu * b_u + A_up * b_p xt::xtensor dot_u(const xt::xtensor &b_u, const xt::xtensor &b_p) const; // c_u = A_uu * b_u + A_up * b_p xt::xtensor dot_p(const xt::xtensor &b ) const; // c_p = A_pu * b_u + A_pp * b_p xt::xtensor dot_p(const xt::xtensor &b_u, const xt::xtensor &b_p) const; // c_p = A_pu * b_u + A_pp * b_p // check structure of the matrices stored per element [nelem, nne*ndim, nne*ndim] void check_diagonal(const xt::xtensor &elemmat) const; // assemble from matrices stored per element [nelem, nne*ndim, nne*ndim] // WARNING: ignores any off-diagonal terms void assemble(const xt::xtensor &elemmat); // set matrix components from externally assembled object void set (const xt::xtensor &matrix ) const; // diagonal [ndof] void set_uu(const xt::xtensor &matrix_uu) const; // diagonal [nnu] void set_pp(const xt::xtensor &matrix_pp) const; // diagonal [nnp] // solve // ("u_p" is useless as all cross-terms are zero, it is here for aesthetics) xt::xtensor solve (const xt::xtensor &rhs ); // [ndof] -> [ndof] xt::xtensor solve (const xt::xtensor &rhs , const xt::xtensor &u_p); // [ndof] -> [ndof] xt::xtensor solve_u(const xt::xtensor &rhs_u ); // [nnu] -> [nnu] xt::xtensor solve_u(const xt::xtensor &rhs_u, const xt::xtensor &u_p); // [nnu] -> [nnu] // get the right-hand-side of prescribed DOFs: [nnu], [nnp] -> [nnp] // ("u_u" is useless as all cross-terms are zero, it is here for aesthetics) xt::xtensor rhs_p(const xt::xtensor &u_u, const xt::xtensor &u_p) const; // return (sub-)matrix as diagonal matrix (column) xt::xtensor asDiagonal () const; // [ndpf] xt::xtensor asDiagonal_uu() const; // [nnu] xt::xtensor asDiagonal_pp() const; // [nnp] // return (sub-)matrix as sparse matrix SpMatD asSparse () const; // [ndof,ndof] SpMatD asSparse_uu() const; // [nnu ,nnu ] SpMatD asSparse_up() const; // [nnu ,nnp ] SpMatD asSparse_pu() const; // [nnp ,nnu ] SpMatD asSparse_pp() const; // [nnp ,nnp ] // return (sub-)matrix as dense matrix xt::xtensor asDense () const; // [ndof,ndof] xt::xtensor asDense_uu() const; // [nnu ,nnu ] xt::xtensor asDense_up() const; // [nnu ,nnp ] xt::xtensor asDense_pu() const; // [nnp ,nnu ] xt::xtensor asDense_pp() const; // [nnp ,nnp ] }; // ------------------------------------------------------------------------------------------------- // matrix/column product: '[ndof,ndof]' * [ndof] -> [ndof] inline xt::xtensor operator* (const MatrixDiagonal &A, const xt::xtensor &b); // ------------------------------------------------------------------------------------------------- } // namespace ... // ================================================================================================= #endif diff --git a/src/GooseFEM/MatrixDiagonal.hpp b/include/GooseFEM/MatrixDiagonal.hpp similarity index 100% rename from src/GooseFEM/MatrixDiagonal.hpp rename to include/GooseFEM/MatrixDiagonal.hpp diff --git a/src/GooseFEM/Mesh.h b/include/GooseFEM/Mesh.h similarity index 100% rename from src/GooseFEM/Mesh.h rename to include/GooseFEM/Mesh.h diff --git a/src/GooseFEM/Mesh.hpp b/include/GooseFEM/Mesh.hpp similarity index 100% rename from src/GooseFEM/Mesh.hpp rename to include/GooseFEM/Mesh.hpp diff --git a/src/GooseFEM/MeshHex8.h b/include/GooseFEM/MeshHex8.h similarity index 100% rename from src/GooseFEM/MeshHex8.h rename to include/GooseFEM/MeshHex8.h diff --git a/src/GooseFEM/MeshHex8.hpp b/include/GooseFEM/MeshHex8.hpp similarity index 100% rename from src/GooseFEM/MeshHex8.hpp rename to include/GooseFEM/MeshHex8.hpp diff --git a/src/GooseFEM/MeshQuad4.h b/include/GooseFEM/MeshQuad4.h similarity index 100% rename from src/GooseFEM/MeshQuad4.h rename to include/GooseFEM/MeshQuad4.h diff --git a/src/GooseFEM/MeshQuad4.hpp b/include/GooseFEM/MeshQuad4.hpp similarity index 100% rename from src/GooseFEM/MeshQuad4.hpp rename to include/GooseFEM/MeshQuad4.hpp diff --git a/src/GooseFEM/MeshTri3.h b/include/GooseFEM/MeshTri3.h similarity index 99% rename from src/GooseFEM/MeshTri3.h rename to include/GooseFEM/MeshTri3.h index 419b19d..60a00cb 100644 --- a/src/GooseFEM/MeshTri3.h +++ b/include/GooseFEM/MeshTri3.h @@ -1,154 +1,154 @@ /* ================================================================================================= (c - GPLv3) T.W.J. de Geus (Tom) | tom@geus.me | www.geus.me | github.com/tdegeus/GooseFEM ================================================================================================= */ #ifndef GOOSEFEM_MESHTRI3_H #define GOOSEFEM_MESHTRI3_H // ------------------------------------------------------------------------------------------------- #include "Mesh.h" // ===================================== GooseFEM::Mesh::Tri3 ====================================== namespace GooseFEM { namespace Mesh { namespace Tri3 { // ------------------------------------------ regular mesh ----------------------------------------- class Regular { private: double m_h; // elementary element edge-size (in both directions) size_t m_nelx; // number of elements in x-direction (length == "m_nelx * m_h") size_t m_nely; // number of elements in y-direction (length == "m_nely * m_h") size_t m_nelem; // number of elements size_t m_nnode; // number of nodes static const size_t m_nne=3; // number of nodes-per-element static const size_t m_ndim=2; // number of dimensions public: // mesh with "2*nelx*nely" 'elements' of edge size "h" Regular(size_t nelx, size_t nely, double h=1.); // sizes size_t nelem() const; // number of elements size_t nnode() const; // number of nodes size_t nne() const; // number of nodes-per-element size_t ndim() const; // number of dimensions // mesh xt::xtensor coor() const; // nodal positions [nnode ,ndim] xt::xtensor conn() const; // connectivity [nelem ,nne ] // boundary nodes: edges xt::xtensor nodesBottomEdge() const; // node-numbers along the bottom edge xt::xtensor nodesTopEdge() const; // node-numbers along the top edge xt::xtensor nodesLeftEdge() const; // node-numbers along the left edge xt::xtensor nodesRightEdge() const; // node-numbers along the right edge // boundary nodes: edges, without corners xt::xtensor nodesBottomOpenEdge() const; // node-numbers along the bottom edge xt::xtensor nodesTopOpenEdge() const; // node-numbers along the top edge xt::xtensor nodesLeftOpenEdge() const; // node-numbers along the left edge xt::xtensor nodesRightOpenEdge() const; // node-numbers along the right edge // boundary nodes: corners size_t nodesBottomLeftCorner() const; // node-number of the bottom - left corner size_t nodesBottomRightCorner() const; // node-number of the bottom - right corner size_t nodesTopLeftCorner() const; // node-number of the top - left corner size_t nodesTopRightCorner() const; // node-number of the top - right corner // boundary nodes: corners (aliases) size_t nodesLeftBottomCorner() const; // alias, see above: nodesBottomLeftCorner size_t nodesLeftTopCorner() const; // alias, see above: nodesBottomRightCorner size_t nodesRightBottomCorner() const; // alias, see above: nodesTopLeftCorner size_t nodesRightTopCorner() const; // alias, see above: nodesTopRightCorner // periodicity xt::xtensor nodesPeriodic() const; // periodic node pairs [:,2]: (independent, dependent) size_t nodesOrigin() const; // bottom-left node, used as reference for periodicity xt::xtensor dofs() const; // DOF-numbers for each component of each node (sequential) xt::xtensor dofsPeriodic() const; // ,, for the case that the periodicity if fully eliminated }; // ----------------------------------------- mesh analysis ----------------------------------------- // read / set the orientation (-1 / +1) of all triangles inline xt::xtensor getOrientation(const xt::xtensor &coor, const xt::xtensor &conn ); inline xt::xtensor setOrientation(const xt::xtensor &coor, const xt::xtensor &conn, int orientation=-1); inline xt::xtensor setOrientation(const xt::xtensor &coor, const xt::xtensor &conn, const xt::xtensor &val, int orientation=-1); // --------------------------------------- re-triangulation ---------------------------------------- // simple interface to compute the full re-triangulation; it uses, depending on the input mesh: // (1) the minimal evasive "TriUpdate" // (2) the more rigorous "TriCompute" inline xt::xtensor retriangulate(const xt::xtensor &coor, const xt::xtensor &conn, int orientation=-1); // ================================= GooseFEM::Mesh::Tri3::Private ================================= namespace Private { // ------------------------- support class - update existing triangulation ------------------------- // minimal evasive re-triangulation which only flips edges of the existing connectivity class TriUpdate { private: size_t m_nelem; // #elements size_t m_nnode; // #nodes size_t m_nne; // #nodes-per-element size_t m_ndim; // #dimensions xt::xtensor m_edge; // the element that neighbors along each edge (m_nelem: no neighbor) xt::xtensor m_conn; // connectivity (updated) xt::xtensor m_coor; // nodal positions (does not change) xt::xtensor_fixed> m_elem; // the two elements in the last element change xt::xtensor_fixed> m_node; // the four nodes in the last element change // old: m_elem(0) = [ m_node(0) , m_node(1) , m_node(2) ] // m_elem(1) = [ m_node(1) , m_node(3) , m_node(2) ] // new: m_elem(0) = [ m_node(0) , m_node(3) , m_node(2) ] // m_elem(1) = [ m_node(0) , m_node(1) , m_node(3) ] // compute neighbors per edge of all elements void edge(); // update edges around renumbered elements void chedge(size_t edge, size_t old_elem, size_t new_elem); public: - TriUpdate(){}; + TriUpdate() = default; TriUpdate(const xt::xtensor &coor, const xt::xtensor &conn); bool eval (); // re-triangulate the full mesh (returns "true" if changed) bool increment(); // one re-triangulation step (returns "true" if changed) xt::xtensor conn() { return m_conn; }; // (new) connectivity xt::xtensor ch_elem() { return m_elem; }; // element involved in last element change xt::xtensor ch_node() { return m_node; }; // nodes involved in last element change }; // -------------------------------- support class - edge definition -------------------------------- // support class to allow the storage of a list of edges class Edge { public: size_t n1 ; // node 1 (edge from node 1-2) size_t n2 ; // node 2 (edge from node 1-2) size_t elem; // element to which the edge belong size_t edge; // edge index within the element (e.g. edge==1 -> n1=conn(0,elem), n2=conn(1,elem)) - Edge(){}; + Edge() = default; Edge(size_t i, size_t j, size_t el, size_t ed, bool sort=false); }; // ------------------------------------------------------------------------------------------------- // compare edges inline bool Edge_cmp (Edge a, Edge b); // check equality inline bool Edge_sort(Edge a, Edge b); // check if "a" is smaller than "b" in terms of node-numbers // ------------------------------------------------------------------------------------------------- } // namespace Private // ------------------------------------------------------------------------------------------------- }}} // namespace ... #endif diff --git a/src/GooseFEM/MeshTri3.hpp b/include/GooseFEM/MeshTri3.hpp similarity index 100% rename from src/GooseFEM/MeshTri3.hpp rename to include/GooseFEM/MeshTri3.hpp diff --git a/src/GooseFEM/Vector.h b/include/GooseFEM/Vector.h similarity index 100% rename from src/GooseFEM/Vector.h rename to include/GooseFEM/Vector.h diff --git a/src/GooseFEM/Vector.hpp b/include/GooseFEM/Vector.hpp similarity index 100% rename from src/GooseFEM/Vector.hpp rename to include/GooseFEM/Vector.hpp diff --git a/src/GooseFEM/python.cpp b/include/GooseFEM/python.cpp similarity index 100% rename from src/GooseFEM/python.cpp rename to include/GooseFEM/python.cpp diff --git a/setup.py b/setup.py index ed32092..ba69979 100644 --- a/setup.py +++ b/setup.py @@ -1,51 +1,51 @@ desc = ''' GooseFEM is a C++ module, wrapped in Python, that provides several predefined finite element meshes. The original C++ module also includes element definitions and several standard finite element simulations. ''' from setuptools import setup, Extension import sys, re import setuptools import pybind11 import pyxtensor -header = open('src/GooseFEM/GooseFEM.h','r').read() +header = open('include/GooseFEM/GooseFEM.h','r').read() world = re.split(r'(.*)(\#define GOOSEFEM_WORLD_VERSION\ )([0-9]+)(.*)',header)[3] major = re.split(r'(.*)(\#define GOOSEFEM_MAJOR_VERSION\ )([0-9]+)(.*)',header)[3] minor = re.split(r'(.*)(\#define GOOSEFEM_MINOR_VERSION\ )([0-9]+)(.*)',header)[3] __version__ = '.'.join([world,major,minor]) ext_modules = [ Extension( 'GooseFEM', - ['src/GooseFEM/python.cpp'], + ['include/GooseFEM/python.cpp'], include_dirs=[ pybind11 .get_include(False), pybind11 .get_include(True ), pyxtensor.get_include(False), pyxtensor.get_include(True ), pyxtensor.find_xtensor(), pyxtensor.find_xtl(), pyxtensor.find_eigen(), ], language='c++' ), ] setup( name = 'GooseFEM', description = 'Finite element meshes, quadrature, and assembly tools', long_description = desc, version = __version__, license = 'GPLv3', author = 'Tom de Geus', author_email = 'tom@geus.me', url = 'https://github.com/tdegeus/GooseFEM', ext_modules = ext_modules, install_requires = ['pybind11>=2.2.0','pyxtensor>=0.0.1'], cmdclass = {'build_ext': pyxtensor.BuildExt}, zip_safe = False, )