HArD::Core2D
Hybrid Arbitrary Degree::Core 2D - Library to implement 2D schemes with edge and cell polynomials as unknowns
Loading...
Searching...
No Matches
discrete-space.hpp
Go to the documentation of this file.
1// -*- C++ -*-
2#ifndef DISCRETE_SPACE_HPP
3#define DISCRETE_SPACE_HPP
4
5#include <iostream>
6
8
9namespace HArDCore2D {
10
11 namespace DSL {
12
13 //------------------------------------------------------------------------------
14
15 bool compare_degrees(const DiscreteSpaceDescriptor::LocalPolynomialSpaceDescriptor & P1,
16 const DiscreteSpaceDescriptor::LocalPolynomialSpaceDescriptor & P2);
17
18 //------------------------------------------------------------------------------
19
20 class DiscreteSpace : public GlobalDOFTable {
21 public:
22
23 typedef std::vector<std::unique_ptr<PolyCellType> > PolyCellContainerType;
24 typedef std::vector<std::unique_ptr<PolyEdgeType> > PolyEdgeContainerType;
25 typedef std::vector<std::unique_ptr<PolynCellType> > PolynCellContainerType;
26 typedef std::vector<std::unique_ptr<PolynxnCellType> > PolynxnCellContainerType;
27 typedef std::vector<std::unique_ptr<PolynEdgeType> > PolynEdgeContainerType;
28 typedef std::vector<std::unique_ptr<RolyCellType> > RolyCellContainerType;
29 typedef std::vector<std::unique_ptr<RolyComplCellType> > RolyComplCellContainerType;
30 typedef std::vector<std::unique_ptr<GolyCellType> > GolyCellContainerType;
31 typedef std::vector<std::unique_ptr<GolyComplCellType> > GolyComplCellContainerType;
32 typedef std::vector<std::unique_ptr<RealVertexType> > RealVertexContainerType;
33 typedef std::vector<std::unique_ptr<RealnVertexType> > RealnVertexContainerType;
34 typedef std::vector<std::unique_ptr<RealnxnVertexType> > RealnxnVertexContainerType;
35 typedef boost::fusion::map<
36 boost::fusion::pair<PolyCellType, std::map<std::string, PolyCellContainerType> >,
37 boost::fusion::pair<PolyEdgeType, std::map<std::string, PolyEdgeContainerType> >,
38 boost::fusion::pair<PolynCellType, std::map<std::string, PolynCellContainerType> >,
39 boost::fusion::pair<PolynxnCellType, std::map<std::string, PolynxnCellContainerType> >,
40 boost::fusion::pair<PolynEdgeType, std::map<std::string, PolynEdgeContainerType> >,
41 boost::fusion::pair<RolyCellType, std::map<std::string, RolyCellContainerType> >,
42 boost::fusion::pair<RolyComplCellType, std::map<std::string, RolyComplCellContainerType> >,
43 boost::fusion::pair<GolyCellType, std::map<std::string, GolyCellContainerType> >,
44 boost::fusion::pair<GolyComplCellType, std::map<std::string, GolyComplCellContainerType> >,
45 boost::fusion::pair<RealVertexType, std::map<std::string, RealVertexContainerType> >,
46 boost::fusion::pair<RealnVertexType, std::map<std::string, RealnVertexContainerType> >,
47 boost::fusion::pair<RealnxnVertexType, std::map<std::string, RealnxnVertexContainerType> >
49
52 bool use_threads = true,
53 std::ostream & output = std::cout
54 );
55
57 {
58 return m_descriptor;
59 }
60
61 const std::string & name() const
62 {
63 return m_descriptor.name();
64 }
65
66 const Mesh & mesh() const
67 {
68 return m_descriptor.mesh();
69 }
70
71 // Getters
72 template<typename T>
73 inline bool isAvailable(const std::string & name) const
74 {
75 if ( !boost::fusion::has_key<T>(m_local_spaces) ) {
76 return false;
77 }
78 return boost::fusion::at_key<T>(m_local_spaces).contains(name);
79 }
80
81 template<typename T>
82 inline const std::vector<std::unique_ptr<T> > & get(const std::string & name) const
83 {
84 return boost::fusion::at_key<T>(m_local_spaces).at(name);
85 }
86
87 template<typename T>
88 std::vector<std::unique_ptr<T> > & get(const std::string & name)
89 {
90 return boost::fusion::at_key<T>(m_local_spaces)[name];
91 }
92
93 void _construct_cell_bases(size_t iT);
94 void _construct_edge_bases(size_t iE);
95
96 private:
97 DiscreteSpaceDescriptor m_descriptor;
98 bool m_use_threads;
99 std::ostream & m_output;
100
101 LocalSpacesContainerType m_local_spaces;
102
103 size_t m_max_cell_degree;
104 size_t m_max_edge_degree;
105
106 std::unique_ptr<GlobalDOFTable> m_dof_map;
107 };
108
109 //------------------------------------------------------------------------------
110
111 struct DiscreteSpaceError {
112 DiscreteSpaceError(const std::string & _message)
113 : message(_message)
114 {
115 // Do nothing
116 }
117
118 std::string message;
119 };
120 } // namespace DSL
121} // namespace HArDCore2D
122
123#endif
Definition discrete-space-descriptor.hpp:43
const Mesh & mesh() const
Definition discrete-space-descriptor.hpp:74
const std::string & name() const
Definition discrete-space-descriptor.hpp:70
std::vector< std::unique_ptr< RealnxnVertexType > > RealnxnVertexContainerType
Definition discrete-space.hpp:34
boost::fusion::map< boost::fusion::pair< PolyCellType, std::map< std::string, PolyCellContainerType > >, boost::fusion::pair< PolyEdgeType, std::map< std::string, PolyEdgeContainerType > >, boost::fusion::pair< PolynCellType, std::map< std::string, PolynCellContainerType > >, boost::fusion::pair< PolynxnCellType, std::map< std::string, PolynxnCellContainerType > >, boost::fusion::pair< PolynEdgeType, std::map< std::string, PolynEdgeContainerType > >, boost::fusion::pair< RolyCellType, std::map< std::string, RolyCellContainerType > >, boost::fusion::pair< RolyComplCellType, std::map< std::string, RolyComplCellContainerType > >, boost::fusion::pair< GolyCellType, std::map< std::string, GolyCellContainerType > >, boost::fusion::pair< GolyComplCellType, std::map< std::string, GolyComplCellContainerType > >, boost::fusion::pair< RealVertexType, std::map< std::string, RealVertexContainerType > >, boost::fusion::pair< RealnVertexType, std::map< std::string, RealnVertexContainerType > >, boost::fusion::pair< RealnxnVertexType, std::map< std::string, RealnxnVertexContainerType > > > LocalSpacesContainerType
Definition discrete-space.hpp:48
std::vector< std::unique_ptr< PolyEdgeType > > PolyEdgeContainerType
Definition discrete-space.hpp:24
std::vector< std::unique_ptr< PolynxnCellType > > PolynxnCellContainerType
Definition discrete-space.hpp:26
DiscreteSpace(const DiscreteSpaceDescriptor &descriptor, bool use_threads=true, std::ostream &output=std::cout)
const std::vector< std::unique_ptr< T > > & get(const std::string &name) const
Definition discrete-space.hpp:82
const Mesh & mesh() const
Definition discrete-space.hpp:66
void _construct_cell_bases(size_t iT)
std::vector< std::unique_ptr< RealVertexType > > RealVertexContainerType
Definition discrete-space.hpp:32
std::vector< std::unique_ptr< GolyCellType > > GolyCellContainerType
Definition discrete-space.hpp:30
const std::string & name() const
Definition discrete-space.hpp:61
void _construct_edge_bases(size_t iE)
std::vector< std::unique_ptr< PolynCellType > > PolynCellContainerType
Definition discrete-space.hpp:25
std::vector< std::unique_ptr< PolynEdgeType > > PolynEdgeContainerType
Definition discrete-space.hpp:27
boost::fusion::map< boost::fusion::pair< PolyCellType, std::map< std::string, PolyCellContainerType > >, boost::fusion::pair< PolyEdgeType, std::map< std::string, PolyEdgeContainerType > >, boost::fusion::pair< PolynCellType, std::map< std::string, PolynCellContainerType > >, boost::fusion::pair< PolynxnCellType, std::map< std::string, PolynxnCellContainerType > >, boost::fusion::pair< PolynEdgeType, std::map< std::string, PolynEdgeContainerType > >, boost::fusion::pair< RolyCellType, std::map< std::string, RolyCellContainerType > >, boost::fusion::pair< RolyComplCellType, std::map< std::string, RolyComplCellContainerType > >, boost::fusion::pair< GolyCellType, std::map< std::string, GolyCellContainerType > >, boost::fusion::pair< GolyComplCellType, std::map< std::string, GolyComplCellContainerType > >, boost::fusion::pair< RealVertexType, std::map< std::string, RealVertexContainerType > >, boost::fusion::pair< RealnVertexType, std::map< std::string, RealnVertexContainerType > >, boost::fusion::pair< RealnxnVertexType, std::map< std::string, RealnxnVertexContainerType > >, boost::fusion::pair< SymPolynxnCellType, std::map< std::string, SymPolynxnCellContainerType > > > LocalSpacesContainerType
Definition discrete-space.hpp:50
std::vector< std::unique_ptr< RealnVertexType > > RealnVertexContainerType
Definition discrete-space.hpp:33
std::vector< std::unique_ptr< T > > & get(const std::string &name)
Definition discrete-space.hpp:88
std::vector< std::unique_ptr< RolyCellType > > RolyCellContainerType
Definition discrete-space.hpp:28
const DiscreteSpaceDescriptor & descriptor() const
Definition discrete-space.hpp:58
std::vector< std::unique_ptr< RolyComplCellType > > RolyComplCellContainerType
Definition discrete-space.hpp:29
std::vector< std::unique_ptr< PolyCellType > > PolyCellContainerType
Definition discrete-space.hpp:23
std::vector< std::unique_ptr< GolyComplCellType > > GolyComplCellContainerType
Definition discrete-space.hpp:31
bool isAvailable(const std::string &name) const
Definition discrete-space.hpp:73
Definition Mesh2D.hpp:26
bool use_threads
Definition HHO_DiffAdvecReac.hpp:47
bool compare_degrees(const DiscreteSpaceDescriptor::LocalPolynomialSpaceDescriptor &P1, const DiscreteSpaceDescriptor::LocalPolynomialSpaceDescriptor &P2)
Definition discrete-space.cpp:14
Definition ddr-klplate.hpp:27
Definition discrete-space.hpp:113
DiscreteSpaceError(const std::string &_message)
Definition discrete-space.hpp:112
std::string message
Definition discrete-space.hpp:120