Skip to content
Snippets Groups Projects
Select Git revision
  • 9532d901f4662a694c34719609decbf0258de2b8
  • develop default protected
  • feature/variational-hydro
  • origin/stage/bouguettaia
  • feature/gmsh-reader
  • feature/reconstruction
  • save_clemence
  • feature/kinetic-schemes
  • feature/local-dt-fsi
  • feature/composite-scheme-sources
  • feature/composite-scheme-other-fluxes
  • feature/serraille
  • feature/composite-scheme
  • hyperplastic
  • feature/polynomials
  • feature/gks
  • feature/implicit-solver-o2
  • feature/coupling_module
  • feature/implicit-solver
  • feature/merge-local-dt-fsi
  • master protected
  • v0.5.0 protected
  • v0.4.1 protected
  • v0.4.0 protected
  • v0.3.0 protected
  • v0.2.0 protected
  • v0.1.0 protected
  • Kidder
  • v0.0.4 protected
  • v0.0.3 protected
  • v0.0.2 protected
  • v0 protected
  • v0.0.1 protected
33 results

test_CFunctionEmbedder.cpp

Blame
  • Mesh.hpp 2.34 KiB
    #ifndef MESH_HPP
    #define MESH_HPP
    
    #include <algebra/TinyVector.hpp>
    #include <mesh/ItemValue.hpp>
    #include <mesh/MeshVariant.hpp>
    #include <utils/GlobalVariableManager.hpp>
    
    #include <memory>
    
    template <typename ConnectivityType>
    class Mesh : public std::enable_shared_from_this<Mesh<ConnectivityType>>
    {
     public:
      using Connectivity = ConnectivityType;
    
      static constexpr size_t Dimension = ConnectivityType::Dimension;
      using Rd                          = TinyVector<Dimension>;
    
     private:
      const size_t m_id;
    
      const std::shared_ptr<const Connectivity> m_connectivity;
      const NodeValue<const Rd> m_xr;
    
      std::ostream&
      _write(std::ostream& os) const
      {
        return os << *m_connectivity;
      }
    
     public:
      friend std::ostream&
      operator<<(std::ostream& os, const Mesh& mesh)
      {
        return mesh._write(os);
      }
    
      PUGS_INLINE
      size_t
      id() const
      {
        return m_id;
      }
    
      PUGS_INLINE
      std::shared_ptr<const Mesh<ConnectivityType>>
      shared_ptr() const
      {
        return this->shared_from_this();
      }
    
      PUGS_INLINE
      operator std::shared_ptr<MeshVariant>() const
      {
        return std::make_shared<MeshVariant>(this->shared_ptr());
      }
    
      PUGS_INLINE
      constexpr size_t
      dimension() const
      {
        return Dimension;
      }
    
      PUGS_INLINE
      const Connectivity&
      connectivity() const
      {
        return *m_connectivity;
      }
    
      PUGS_INLINE
      const auto&
      shared_connectivity() const
      {
        return m_connectivity;
      }
    
      PUGS_INLINE
      size_t
      numberOfNodes() const
      {
        return m_connectivity->numberOfNodes();
      }
    
      PUGS_INLINE
      size_t
      numberOfEdges() const
      {
        return m_connectivity->numberOfEdges();
      }
    
      PUGS_INLINE
      size_t
      numberOfFaces() const
      {
        return m_connectivity->numberOfFaces();
      }
    
      PUGS_INLINE
      size_t
      numberOfCells() const
      {
        return m_connectivity->numberOfCells();
      }
    
      template <ItemType item_type>
      PUGS_INLINE size_t
      numberOf() const
      {
        return m_connectivity->template numberOf<item_type>();
      }
    
      PUGS_INLINE
      const NodeValue<const Rd>&
      xr() const
      {
        return m_xr;
      }
    
      Mesh() = delete;
    
      PUGS_INLINE
      Mesh(const std::shared_ptr<const Connectivity>& connectivity, const NodeValue<const Rd>& xr)
        : m_id{GlobalVariableManager::instance().getAndIncrementMeshId()}, m_connectivity{connectivity}, m_xr{xr}
      {
        ;
      }
    
      Mesh(const Mesh&) = delete;
      Mesh(Mesh&&)      = delete;
    
      ~Mesh();
    };
    
    #endif   // MESH_HPP