aprioriRef2D.hh

Go to the documentation of this file.
1 
6 #ifndef APRIORIRef2D_hh
7 #define APRIORIRef2D_hh
8 
9 #include "basics/typedefs.hh"
10 #include "basics/exceptions.hh"
11 #include "basics/level.hh"
12 #include "geometry/connectorSet.hh"
13 #include "geometry/connector.hh"
14 #include "space/postProcess.hh"
15 #include "space/hpMethod.hh"
16 
17 // forward declaration
18 namespace concepts {
19  class Quad;
20 }
21 
22 namespace hp2D {
23 
24  using concepts::Real;
25 
26  // ***************************************************** APrioriRefinement **
27 
41  public:
42  enum subdivTypes { NONE = 0, X = 1, Y = 2};
43  static const short MAXSHORT = 32767;
58  concepts::Attribute attribVtx, concepts::Attribute attribEdge,
59  const int* const p, const uint subdiv = X | Y,
60  const concepts::Attribute attribCell = 0) :
61  spc_(&spc), attribVtx_(attribVtx), attribEdge_(attribEdge),
62  attribCell_(nullptr), p_(p),
63  subdiv_(subdiv), level_(MAXSHORT) {
64  if (attribCell) attribCell_.reset(new concepts::Attribute(attribCell));
65  }
68  const int* const p, const uint subdiv = X | Y,
69  const concepts::Level<2> level = MAXSHORT) :
70  spc_(&spc), adj_(0), attribVtx_(0), attribEdge_(0), attribCell_(nullptr),
71  p_(p), subdiv_(subdiv), level_(level) {}
88  concepts::Attribute attribVtx,
89  concepts::Attribute attribEdge,
90  const int* const p, const uint subdiv = X | Y) :
91  spc_(0), adj_(&adj), attribVtx_(attribVtx), attribEdge_(attribEdge),
92  attribCell_(nullptr), p_(p), subdiv_(subdiv), level_(MAXSHORT) {}
93 
94  virtual void operator() (const concepts::Element<Real>& elm)
96  virtual void operator() (const concepts::Cell& cell)
98  protected:
99  virtual std::ostream& info(std::ostream& os) const;
100  private:
109  std::unique_ptr<concepts::Attribute> attribCell_;
111  const int* const p_;
113  const uint subdiv_;
119  };
120 
121  // ************************************************* APrioriRefinementRule **
122 
124  public:
125  enum subdivTypes { NONE = 0, X = 1, Y = 2};
126  static const short MAXSHORT = 32767;
127 
128  virtual concepts::AdaptiveAdjustP<2> operator()
129  (const concepts::Connector2& q) const = 0;
130  protected:
131  virtual std::ostream& info(std::ostream& os) const;
132  };
133 
134  // ******************************************** APrioriGeometricRefinement **
135 
140  public:
153  const int* const p, const uint subdiv = X | Y);
157  p_(rule.p_), subdiv_(rule.subdiv_) {}
162 
163  virtual concepts::AdaptiveAdjustP<2> operator()
164  (const concepts::Connector2& q) const;
165  protected:
166  virtual std::ostream& info(std::ostream& os) const;
167  private:
171  const int* const p_;
173  const uint subdiv_;
174  };
175 
176  // ********************************************** APrioriRegularRefinement **
177 
182  public:
188  APrioriRegularRefinement(const int* const p, const uint subdiv = X | Y) :
189  p_(p), subdiv_(subdiv) {}
192  p_(rule.p_), subdiv_(rule.subdiv_) {}
193  virtual concepts::AdaptiveAdjustP<2> operator()
194  (const concepts::Connector2& q) const;
195  protected:
196  virtual std::ostream& info(std::ostream& os) const;
197  private:
199  const int* const p_;
201  const uint subdiv_;
202  };
203 
204  // ************************************************** APrioriRefinementNew **
205 
207  public:
214  APrioriRefinementRule* rule = 0) :
215  adj_(&adj), rule_(rule) {}
218  if (rule)
219  rules_[attrib] = rule;
220  else {
221  std::map<uint, APrioriRefinementRule*>::
222  iterator i = rules_.find(attrib);
223  if (i != rules_.end()) rules_.erase(i);
224  }
225  }
226  virtual void operator() (const concepts::Element<Real>& elm)
228  virtual void operator() (const concepts::Cell& cell)
230  private:
237  std::map<uint, APrioriRefinementRule*> rules_;
238  };
239 
240 } // namespace hp2D
241 
242 #endif // APRIORIRef2D_hh
Class for holding a rule for a particular h- and p-refinement until an maximum level and maximum poly...
concepts::Set< concepts::Attribute > & attribEdge()
Returns set of attributes to refine toward this edge.
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
virtual void operator()(const concepts::Element< Real > &elm)
const int *const p_
Maximal p in a refinement step in each subdiv.
std::unique_ptr< concepts::Attribute > attribCell_
Attribute of the cells which are allowed to refine.
A quadrilateral in the topology.
Definition: topology.hh:272
APrioriRefinement(concepts::AdaptiveSpace< Real, concepts::AdaptiveAdjustP< 2 > > &spc, const int *const p, const uint subdiv=X|Y, const concepts::Level< 2 > level=MAXSHORT)
Definition: aprioriRef2D.hh:67
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
A cell in a mesh consist of topological information (neighbours, connectivity, orientation) and geome...
Definition: cell.hh:39
APrioriRefinement(concepts::AdaptiveSpace< Real, concepts::AdaptiveAdjustP< 2 > > &spc, concepts::Attribute attribVtx, concepts::Attribute attribEdge, const int *const p, const uint subdiv=X|Y, const concepts::Attribute attribCell=0)
Constructor for refining an adaptive space.
Definition: aprioriRef2D.hh:57
concepts::AdaptiveAdjustP< 2 > computeRef_(const concepts::Quad &q, concepts::Level< 2 > level) const
Computes the refinement solely using topological information.
concepts::Adaptivity< concepts::Connector, concepts::AdaptiveAdjustP< 2 > > * adj_
Adaptive space pre builder.
APrioriRefinement(concepts::Adaptivity< concepts::Connector, concepts::AdaptiveAdjustP< 2 > > &adj, concepts::Attribute attribVtx, concepts::Attribute attribEdge, const int *const p, const uint subdiv=X|Y)
Constructor for refining a space pre builder.
Definition: aprioriRef2D.hh:86
const int *const p_
Maximal p in a refinement step in each subdiv.
const int *const p_
Maximal p in a refinement step in each subdiv.
2D hp-FEM for H1-conforming elements.
const concepts::Level< 2 > level_
This or higher level.
concepts::Set< concepts::Attribute > & attribVtx()
Returns set of attributes to refine toward this vertices.
concepts::Attribute attribEdge_
APrioriGeometricRefinement(concepts::Attribute attribVtx, concepts::Attribute attribEdge, const int *const p, const uint subdiv=X|Y)
Constructor.
Abstract base class for an adaptive classes, a.o.t.
Definition: space.hh:332
APrioriRefinementNew(concepts::Adaptivity< concepts::Connector, concepts::AdaptiveAdjustP< 2 > > &adj, APrioriRefinementRule *rule=0)
Constructor.
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
static const short MAXSHORT
concepts::Set< concepts::Attribute > attribVtx_
Set of attributes to refine towards this vertices or edges.
virtual void operator()(const concepts::Element< Real > &elm)
const uint subdiv_
Subdivision strategy.
A 2D element of the topology.
Definition: connector.hh:226
concepts::Attribute attribVtx_
Attribute of entity to which should be refined.
const uint subdiv_
Subdivision strategy.
APrioriRefinementRule * rule_
Default rule.
std::map< uint, APrioriRefinementRule * > rules_
Rules.
concepts::Adaptivity< concepts::Connector, concepts::AdaptiveAdjustP< 2 > > * adj_
Adaptive space pre builder.
APrioriRegularRefinement(const int *const p, const uint subdiv=X|Y)
Constructor.
APrioriGeometricRefinement(const APrioriGeometricRefinement &rule)
Copy constructor.
Exception class to express a missing feature.
Definition: exceptions.hh:206
Class for holding a rule for geometric refinement towards edges and vertices.
APrioriRegularRefinement(const APrioriRegularRefinement &rule)
Copy constructor.
Abstract base class for an adaptive space.
Definition: space.hh:350
concepts::Set< concepts::Attribute > attribEdge_
concepts::AdaptiveSpace< Real, concepts::AdaptiveAdjustP< 2 > > * spc_
Space to be refined.
Class providing an output operator.
static const short MAXSHORT
Definition: aprioriRef2D.hh:43
Carries out a-priori given refinements.
Definition: aprioriRef2D.hh:40
Abstract class for per cell postprocessing.
Definition: postProcess.hh:38
Attributes for elements of the topology.
Definition: connector.hh:22
void add(concepts::Attribute attrib, APrioriRefinementRule *rule)
Adds rule for a particular cell attribute.
An abstract class for elements of the topology.
Definition: connector.hh:85
double Real
Type normally used for a floating point number.
Definition: typedefs.hh:36
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
Basic namespace for Concepts-2.
Definition: pml_formula.h:16
const uint subdiv_
Subdivision strategy.
Page URL: http://wiki.math.ethz.ch/bin/view/Concepts/WebHome
21 August 2020
© 2020 Eidgenössische Technische Hochschule Zürich