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
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 std::vector<std::unique_ptr<SymPolynxnCellType> > SymPolynxnCellContainerType;
36 typedef boost::fusion::map<
37 boost::fusion::pair<PolyCellType, std::map<std::string, PolyCellContainerType> >,
38 boost::fusion::pair<PolyEdgeType, std::map<std::string, PolyEdgeContainerType> >,
39 boost::fusion::pair<PolynCellType, std::map<std::string, PolynCellContainerType> >,
40 boost::fusion::pair<PolynxnCellType, std::map<std::string, PolynxnCellContainerType> >,
41 boost::fusion::pair<PolynEdgeType, std::map<std::string, PolynEdgeContainerType> >,
42 boost::fusion::pair<RolyCellType, std::map<std::string, RolyCellContainerType> >,
43 boost::fusion::pair<RolyComplCellType, std::map<std::string, RolyComplCellContainerType> >,
44 boost::fusion::pair<GolyCellType, std::map<std::string, GolyCellContainerType> >,
45 boost::fusion::pair<GolyComplCellType, std::map<std::string, GolyComplCellContainerType> >,
46 boost::fusion::pair<RealVertexType, std::map<std::string, RealVertexContainerType> >,
47 boost::fusion::pair<RealnVertexType, std::map<std::string, RealnVertexContainerType> >,
48 boost::fusion::pair<RealnxnVertexType, std::map<std::string, RealnxnVertexContainerType> >,
49 boost::fusion::pair<SymPolynxnCellType, std::map<std::string, SymPolynxnCellContainerType> >
51
54 bool use_threads = true,
55 std::ostream & output = std::cout
56 );
57
59 {
60 return m_descriptor;
61 }
62
63 const std::string & name() const
64 {
65 return m_descriptor.name();
66 }
67
68 const Mesh & mesh() const
69 {
70 return m_descriptor.mesh();
71 }
72
73 // Getters
74 template<typename T>
75 inline bool isAvailable(const std::string & name) const
76 {
77 if ( !boost::fusion::has_key<T>(m_local_spaces) ) {
78 return false;
79 }
80 return boost::fusion::at_key<T>(m_local_spaces).contains(name);
81 }
82
83 template<typename T>
84 inline const std::vector<std::unique_ptr<T> > & get(const std::string & name) const
85 {
86 return boost::fusion::at_key<T>(m_local_spaces).at(name);
87 }
88
89 template<typename T>
90 std::vector<std::unique_ptr<T> > & get(const std::string & name)
91 {
92 return boost::fusion::at_key<T>(m_local_spaces)[name];
93 }
94
95 void _construct_cell_bases(size_t iT);
96 void _construct_edge_bases(size_t iE);
97
98 private:
99 DiscreteSpaceDescriptor m_descriptor;
100 bool m_use_threads;
101 std::ostream & m_output;
102
103 LocalSpacesContainerType m_local_spaces;
104
105 size_t m_max_cell_degree;
106 size_t m_max_edge_degree;
107
108 std::unique_ptr<GlobalDOFTable> m_dof_map;
109 };
110
111 //------------------------------------------------------------------------------
112
114 DiscreteSpaceError(const std::string & _message)
115 : message(_message)
116 {
117 // Do nothing
118 }
119
120 std::string message;
121 };
122 } // namespace DSL
123} // namespace HArDCore2D
124
125#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
Definition discrete-space.hpp:20
std::vector< std::unique_ptr< RealnxnVertexType > > RealnxnVertexContainerType
Definition discrete-space.hpp:34
std::vector< std::unique_ptr< PolyEdgeType > > PolyEdgeContainerType
Definition discrete-space.hpp:24
std::vector< std::unique_ptr< PolynxnCellType > > PolynxnCellContainerType
Definition discrete-space.hpp:26
const std::vector< std::unique_ptr< T > > & get(const std::string &name) const
Definition discrete-space.hpp:84
const Mesh & mesh() const
Definition discrete-space.hpp:68
std::vector< std::unique_ptr< RealVertexType > > RealVertexContainerType
Definition discrete-space.hpp:32
void _construct_edge_bases(size_t iE)
Definition discrete-space.cpp:183
std::vector< std::unique_ptr< GolyCellType > > GolyCellContainerType
Definition discrete-space.hpp:30
const std::string & name() const
Definition discrete-space.hpp:63
void _construct_cell_bases(size_t iT)
Definition discrete-space.cpp:123
std::vector< std::unique_ptr< SymPolynxnCellType > > SymPolynxnCellContainerType
Definition discrete-space.hpp:35
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:90
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:75
Base class for global DOF spaces. Provides functions to manipulate global DOFs (the local version bei...
Definition global-dof-table.hpp:18
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:114
std::string message
Definition discrete-space.hpp:120