Vulpes  0.1.0
Versatile and parallel compUtational Library for high-order discontinuous Polytopal Element Simulations
Loading...
Searching...
No Matches
mesh_2d.cpp File Reference
#include "vulpes/geometry/mesh/mesh_2d.hpp"
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstddef>
#include <cstdint>
#include <fstream>
#include <iostream>
#include <limits>
#include <map>
#include <stdexcept>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <Eigen/Dense>
#include <vtkCell.h>
#include <vtkCellArray.h>
#include <vtkGenericDataObjectReader.h>
#include <vtkIdList.h>
#include <vtkNew.h>
#include <vtkPoints.h>
#include <vtkPolyData.h>
#include <vtkPolyDataReader.h>
#include <vtkPolygon.h>
#include <vtkPolyhedron.h>
#include <vtkSmartPointer.h>
#include <vtkType.h>
#include <vtkUnstructuredGrid.h>
#include <vtkXMLUnstructuredGridReader.h>
#include <vtkXMLUnstructuredGridWriter.h>
#include "vulpes/datastructure/crs_map.hpp"
#include "vulpes/datastructure/kdtree.hpp"
#include "vulpes/geometry/mesh/mesh_base.hpp"
#include "vulpes/geometry/mesh_exporter.hpp"
#include "vulpes/utils/profiler.hpp"
#include "vulpes/utils/vvutils.hpp"
Include dependency graph for mesh_2d.cpp:

Namespaces

namespace  vulpes
namespace  vulpes::geometry
namespace  vulpes::geometry::mesh2d
namespace  vulpes::geometry::mesh2d::internal

Typedefs

using vulpes::geometry::mesh2d::internal::CellIntersectStatusType = int8_t
using vulpes::geometry::mesh2d::internal::CartesianCellStatues = Eigen::Matrix<CellIntersectStatusType, -1, -1>
template<typename IndexType>
using vulpes::geometry::mesh2d::internal::CartCellToFineFacet = datastructure::CrsMap<IndexType, IndexType>
template<typename IndexType>
using vulpes::geometry::mesh2d::internal::EdgeIntersection = std::array<IndexType, 3>
template<typename IndexType>
using vulpes::geometry::mesh2d::internal::EdgeIntersectionTable = std::map<EdgeIntersection<IndexType>, IndexType>
template<typename IndexType>
using vulpes::geometry::mesh2d::internal::IntersectionPtr = typename EdgeIntersectionTable<IndexType>::iterator

Enumerations

enum  vulpes::geometry::mesh2d::internal::CellIntersectStatus : CellIntersectStatusType { vulpes::geometry::mesh2d::internal::BND = 0 , vulpes::geometry::mesh2d::internal::INTERNAL = 1 , vulpes::geometry::mesh2d::internal::EXTERNAL = 2 }

Functions

std::string vulpes::geometry::mesh2d::internal::getFileExtension (const std::string &filename)
std::vector< std::array< double, 3 > > vulpes::geometry::mesh2d::internal::readpts (const std::string &filename)
template<typename FloatType, typename IndexType>
std::pair< CartesianCellStatues, CartCellToFineFacet< IndexType > > vulpes::geometry::mesh2d::internal::findBoundaryCartCells (const Mesh2D< FloatType, IndexType > &mesh, const std::array< std::vector< FloatType >, 2 > &grids)
template<typename FloatType, typename IndexType>
void vulpes::geometry::mesh2d::internal::findInternalCartCells (const Mesh2D< FloatType, IndexType > &mesh, const std::array< std::vector< FloatType >, 2 > &grids, CartesianCellStatues &cart_cell_intersect)
template<typename FloatType, typename IndexType>
auto vulpes::geometry::mesh2d::internal::extractInternalVtxsAndCells (const Mesh2D< FloatType, IndexType > &cart_mesh, const CartesianCellStatues &cart_cell_intersect)
template<typename FloatType, typename IndexType>
auto vulpes::geometry::mesh2d::internal::intersectCartCellWithFineFacet (const Mesh2D< FloatType, IndexType > &mesh, const Mesh2D< FloatType, IndexType > &cart_mesh, const CartCellToFineFacet< IndexType > &, IndexType ccid, IndexType fvid1, IndexType fvid2, EdgeIntersectionTable< IndexType > &edges_intersections, std::vector< Point< FloatType, 2 > > &new_vtxs)
template<typename FloatType, typename IndexType>
IndexType vulpes::geometry::mesh2d::internal::findCartVtxOnTheRight (const Mesh2D< FloatType, IndexType > &mesh, const Mesh2D< FloatType, IndexType > &cart_mesh, IntersectionPtr< IndexType > intersection, bool right=true)
template<typename FloatType, typename IndexType>
auto vulpes::geometry::mesh2d::internal::splitFacetsIntoSequencesOfVtxs (const Mesh2D< FloatType, IndexType > &mesh, const CartCellToFineFacet< IndexType > &cart_cell_to_fine_facet, const std::array< std::vector< FloatType >, 2 > &grids, IndexType ccid)
template<typename FloatType, typename IndexType>
auto vulpes::geometry::mesh2d::internal::createNewCell (const Mesh2D< FloatType, IndexType > &mesh, const Mesh2D< FloatType, IndexType > &cart_mesh, const std::array< std::vector< FloatType >, 2 > &, const CartCellToFineFacet< IndexType > &cart_cell_to_fine_facet, const CartesianCellStatues &, const std::vector< IndexType > &old_to_new_cart_vid, const std::vector< IndexType > &fvid_seq, IndexType ccid, EdgeIntersectionTable< IndexType > &edges_intersections, std::vector< Point< FloatType, 2 > > &new_vtxs, datastructure::CrsMapUncompressed< IndexType > &new_cell_to_vtxs, Eigen::Map< Eigen::Vector4i > cvid_cnt)
template<typename FloatType, typename IndexType>
auto vulpes::geometry::mesh2d::internal::mergeLastCell (const Mesh2D< FloatType, IndexType > &, const Mesh2D< FloatType, IndexType > &cart_mesh, const std::array< std::vector< FloatType >, 2 > &grids, const CartCellToFineFacet< IndexType > &, const CartesianCellStatues &, const std::vector< IndexType > &old_to_new_cart_vid, const std::vector< std::vector< IndexType > > &fvid_seqs, const Eigen::Matrix4Xi &cvid_cnt, IndexType ccid, const std::vector< Point< FloatType, 2 > > &new_vtxs, datastructure::CrsMapUncompressed< IndexType > &new_cell_to_vtxs)
template<typename FloatType, typename IndexType>
auto vulpes::geometry::mesh2d::internal::clipBoundaryCells (const Mesh2D< FloatType, IndexType > &mesh, const Mesh2D< FloatType, IndexType > &cart_mesh, const std::array< std::vector< FloatType >, 2 > &grids, const CartCellToFineFacet< IndexType > &cart_cell_to_fine_facet, const CartesianCellStatues &cart_cell_intersect, const std::vector< IndexType > &old_to_new_cart_vid, std::vector< Point< FloatType, 2 > > &new_vtxs, datastructure::CrsMapUncompressed< IndexType > &new_cell_to_vtxs)
template<typename FloatType, typename IndexType>
std::vector< IndexType > vulpes::geometry::mesh2d::internal::computeAgglomerationIndicator (const Mesh2D< FloatType, IndexType > &new_mesh, FloatType standard_measure, FloatType agglomeration_threshold)
template<typename FloatType, typename IndexType>
Mesh2D< FloatType, IndexType > vulpes::geometry::mesh2d::intersectCartesianGrid (const Mesh2D< FloatType, IndexType > &mesh, const std::array< std::vector< FloatType >, 2 > &grids, FloatType agglomeration_threshold=0.25)
 Creates a new mesh by intersecting an existing mesh with a Cartesian grid.
template<typename FloatType, typename IndexType>
Mesh2D< FloatType, IndexType > vulpes::geometry::mesh2d::mergeMeshes (const Mesh2D< FloatType, IndexType > &mesh_a, const Mesh2D< FloatType, IndexType > &mesh_b, FloatType atol=0.0, FloatType rtol=1e-4)
 Merges two separate meshes into a single mesh.
template<typename FloatType, typename IndexType>
Mesh2D< FloatType, IndexType > vulpes::geometry::mesh2d::read (const std::string &filename, bool check_vtxs_unique=true, bool add_tags=true)
 Reads a mesh from a .vtk or .vtu file and creates a Mesh2D object.
template<typename FloatType, typename IndexType>
Mesh2D< FloatType, IndexType > vulpes::geometry::mesh2d::rectangle (const Point< FloatType, 2 > &corner_a, const Point< FloatType, 2 > &corner_b, const Point< IndexType, 2 > &n_divisions, bool tria_elements=false)
 Creates a simple rectangular mesh.
template<typename FloatType, typename IndexType>
Mesh2D< FloatType, IndexType > vulpes::geometry::mesh2d::collapseEdges (const Mesh2D< FloatType, IndexType > &mesh, FloatType edge_collapse_tol)
 Remove edges smaller than a given tolerance.
template Mesh2D< double, int32_t > vulpes::geometry::mesh2d::intersectCartesianGrid< double, int32_t > (const Mesh2D< double, int32_t > &, const std::array< std::vector< double >, 2 > &, double)
template Mesh2D< double, int32_t > vulpes::geometry::mesh2d::mergeMeshes< double, int32_t > (const Mesh2D< double, int32_t > &, const Mesh2D< double, int32_t > &, double, double)
template Mesh2D< double, int32_t > vulpes::geometry::mesh2d::collapseEdges (const Mesh2D< double, int32_t > &, double)
template Mesh2D< double, int32_t > vulpes::geometry::mesh2d::read< double, int32_t > (const std::string &, bool, bool)
template Mesh2D< double, uint32_t > vulpes::geometry::mesh2d::read< double, uint32_t > (const std::string &, bool, bool)
template Mesh2D< double, int64_t > vulpes::geometry::mesh2d::read< double, int64_t > (const std::string &, bool, bool)
template Mesh2D< double, uint64_t > vulpes::geometry::mesh2d::read< double, uint64_t > (const std::string &, bool, bool)
template Mesh2D< double, int32_t > vulpes::geometry::mesh2d::rectangle< double, int32_t > (const Point< double, 2 > &, const Point< double, 2 > &, const Point< int32_t, 2 > &, bool)
template Mesh2D< double, uint32_t > vulpes::geometry::mesh2d::rectangle< double, uint32_t > (const Point< double, 2 > &, const Point< double, 2 > &, const Point< uint32_t, 2 > &, bool)
template Mesh2D< double, int64_t > vulpes::geometry::mesh2d::rectangle< double, int64_t > (const Point< double, 2 > &, const Point< double, 2 > &, const Point< int64_t, 2 > &, bool)
template Mesh2D< double, uint64_t > vulpes::geometry::mesh2d::rectangle< double, uint64_t > (const Point< double, 2 > &, const Point< double, 2 > &, const Point< uint64_t, 2 > &, bool)
template<typename FloatType, typename IndexType>
Mesh2D< FloatType, IndexType > vulpes::geometry::mesh2d::rectangle_periodic (const Point< FloatType, 2 > &corner_a, const Point< FloatType, 2 > &corner_b, const Point< IndexType, 2 > &n_divisions, bool tria_elements=false, bool x_periodic=true, bool y_periodic=true)
 Creates a rectangular mesh and directly annotates it as periodic.
template Mesh2D< double, int32_t > vulpes::geometry::mesh2d::rectangle_periodic< double, int32_t > (const Point< double, 2 > &, const Point< double, 2 > &, const Point< int32_t, 2 > &, bool, bool, bool)
template Mesh2D< double, uint32_t > vulpes::geometry::mesh2d::rectangle_periodic< double, uint32_t > (const Point< double, 2 > &, const Point< double, 2 > &, const Point< uint32_t, 2 > &, bool, bool, bool)
template Mesh2D< double, int64_t > vulpes::geometry::mesh2d::rectangle_periodic< double, int64_t > (const Point< double, 2 > &, const Point< double, 2 > &, const Point< int64_t, 2 > &, bool, bool, bool)
template Mesh2D< double, uint64_t > vulpes::geometry::mesh2d::rectangle_periodic< double, uint64_t > (const Point< double, 2 > &, const Point< double, 2 > &, const Point< uint64_t, 2 > &, bool, bool, bool)
template<typename FloatType, typename IndexType>
bool vulpes::geometry::mesh2d::isPeriodic (const Mesh2D< FloatType, IndexType > &mesh)
template bool vulpes::geometry::mesh2d::isPeriodic< double, int32_t > (const Mesh2D< double, int32_t > &)
template<typename FloatType, typename IndexType>
Mesh2D< FloatType, IndexType > vulpes::geometry::mesh2d::closePeriodicTopology (const Mesh2D< FloatType, IndexType > &mesh)
template Mesh2D< double, int32_t > vulpes::geometry::mesh2d::closePeriodicTopology< double, int32_t > (const Mesh2D< double, int32_t > &)
template<typename FloatType, typename IndexType>
Mesh2D< FloatType, IndexType > vulpes::geometry::mesh2d::openPeriodicTopology (const Mesh2D< FloatType, IndexType > &mesh)
template Mesh2D< double, int32_t > vulpes::geometry::mesh2d::openPeriodicTopology< double, int32_t > (const Mesh2D< double, int32_t > &)
template<typename FloatType, typename IndexType>
std::vector< Point< FloatType, 2 > > vulpes::geometry::mesh2d::getCellVertexesPeriodic (const Mesh2D< FloatType, IndexType > &mesh, IndexType cell_id)
template std::vector< Point< double, 2 > > vulpes::geometry::mesh2d::getCellVertexesPeriodic< double, int32_t > (const Mesh2D< double, int32_t > &, int32_t)