hpMethod.hh

Go to the documentation of this file.
1 
6 #ifndef hpMethod_hh
7 #define hpMethod_hh
8 
9 #include <cstring>
10 #include "basics/level.hh"
11 #include "toolbox/array.hh"
12 #include "space.hh"
13 #include "postProcess.hh"
14 
15 namespace concepts {
16 
17  // ****************************************************** AdaptiveControlP **
18 
27  template<int dim, class F = uint>
28  struct AdaptiveControlP : public AdaptiveControl<F> {
30  ushort p_[dim];
31 
35  std::memset(p_, 0, dim*sizeof(ushort));
36  }
37 
38  bool operator!=(const AdaptiveControlP<dim,F>& a) { return this != &a; }
39 
40  std::ostream& info(std::ostream& os) const;
41  };
42 
43  template<int dim, class F>
44  std::ostream& operator<<(std::ostream& os, const AdaptiveControlP<dim, F>& a)
45  {
46  return a.info(os);
47  }
48 
49  // ******************************************************* AdaptiveAdjustP **
50 
58  template<int dim>
59  class AdaptiveAdjustP : public AdaptiveAdjust<dim> {
60  public:
64  short p_[dim];
65 
70  std::memset(p_, 0, dim*sizeof(short));
71  }
76  AdaptiveAdjustP(short l, int* p) :
77  AdaptiveAdjust<dim>(l) {
78  for (int i = 0; i < dim; ++i) p_[i] = p[i];
79  }
84  AdaptiveAdjustP(short l, const int p) :
85  AdaptiveAdjust<dim>(l) {
86  for (int i = 0; i < dim; ++i) p_[i] = p;
87  }
92  AdaptiveAdjustP(short l, const Array<int> p) :
93  AdaptiveAdjust<dim>(l) {
94  conceptsAssert(p.size() == dim, Assertion());
95  for (int i = 0; i < dim; ++i) p_[i] = p[i];
96  }
101  AdaptiveAdjustP(const Level<dim>& l, const int p) {
102  this->level_ = l;
103  for (int i = 0; i < dim; ++i) p_[i] = p;
104  }
109  AdaptiveAdjustP(const Level<dim>& l, const int* p) {
110  this->level_ = l;
111  for (int i = 0; i < dim; ++i) p_[i] = p[i];
112  }
117  AdaptiveAdjustP(const Level<dim>& l, const Array<int> p) {
118  conceptsAssert(p.size() == dim, Assertion());
119  this->level_ = l;
120  for (int i = 0; i < dim; ++i) p_[i] = p[i];
121  }
122 
124 
125  std::ostream& info(std::ostream& os) const;
126  };
127 
128  template<int dim>
129  std::ostream& operator<<(std::ostream& os, const AdaptiveAdjustP<dim>& a) {
130  return a.info(os);
131  }
132 
133  // *********************************************************** HRefinement **
134 
144  template<typename F, int dim>
145  class HRefinement : public CellPostprocess<F> {
146  public:
151  virtual void operator() (const Element<F>& elm) throw(MissingFeature);
152  virtual void operator() (const Cell& cell) throw(MissingFeature) {}
153  protected:
154  virtual std::ostream& info(std::ostream& os) const;
155  private:
158  };
159 
160  // *********************************************************** PRefinement **
161 
171  template<typename F, int dim>
172  class PRefinement : public CellPostprocess<F> {
173  public:
178  virtual void operator() (const Element<F>& elm) throw(MissingFeature);
179  virtual void operator() (const Cell& cell) throw(MissingFeature) {}
180  protected:
181  virtual std::ostream& info(std::ostream& os) const;
182  private:
185  };
186 
187 } // namespace concepts
188 
189 #endif // hpMethod_hh
uint size() const
Returns the requested size of the array.
Definition: array.hh:259
PRefinement(AdaptiveSpace< F, AdaptiveAdjustP< dim > > &spc)
Constructor.
Definition: hpMethod.hh:177
An abstract class for an element of a space.
Definition: exceptions.hh:15
virtual void operator()(const Element< F > &elm)
Application operator.
std::ostream & info(std::ostream &os) const
short p_[dim]
Difference in the polynomial degree.
Definition: hpMethod.hh:64
Uniform h refinement.
Definition: hpMethod.hh:145
A cell in a mesh consist of topological information (neighbours, connectivity, orientation) and geome...
Definition: cell.hh:39
virtual void operator()(const Element< F > &elm)
Application operator.
#define conceptsAssert(cond, exc)
Assert that a certain condition is fulfilled.
Definition: exceptions.hh:394
AdaptiveAdjustP(const Level< dim > &l, const int *p)
Constructor.
Definition: hpMethod.hh:109
AdaptiveAdjustP(const Level< dim > &l, const Array< int > p)
Constructor.
Definition: hpMethod.hh:117
ushort p_[dim]
Polynomial degree.
Definition: hpMethod.hh:30
AdaptiveAdjustP< dim > & operator=(const AdaptiveAdjustP< dim > &a)
AdaptiveAdjustP()
Constructor.
Definition: hpMethod.hh:69
Class to describe control structures of an adaptive space.
Definition: space.hh:271
Describe control structures of a high order adaptive space.
Definition: hpMethod.hh:28
Level< levelDim > level_
Level in several dimensions.
Definition: space.hh:302
Exception class for assertions.
Definition: exceptions.hh:258
AdaptiveAdjustP(short l, const int p)
Constructor.
Definition: hpMethod.hh:84
std::ostream & operator<<(std::ostream &os, const Level< dim > &c)
bool operator!=(const AdaptiveControlP< dim, F > &a)
Definition: hpMethod.hh:38
AdaptiveSpace< F, AdaptiveAdjustP< dim > > & spc_
Space to be refined.
Definition: hpMethod.hh:184
AdaptiveSpace< F, AdaptiveAdjustP< dim > > & spc_
Space to be refined.
Definition: hpMethod.hh:157
std::ostream & info(std::ostream &os) const
AdaptiveAdjustP(short l, const Array< int > p)
Constructor.
Definition: hpMethod.hh:92
Class to describe adjustments to elements in an adaptive space.
Definition: hpMethod.hh:59
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
Level information used for multidimensional hp FEM.
Definition: level.hh:22
unsigned short ushort
Abbreviation for unsigned short.
Definition: typedefs.hh:48
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
Exception class to express a missing feature.
Definition: exceptions.hh:206
Class to describe adjustments to elements in an adaptive space.
Definition: space.hh:299
AdaptiveAdjustP(short l, int *p)
Constructor.
Definition: hpMethod.hh:76
Uniform p refinement.
Definition: hpMethod.hh:172
Abstract base class for an adaptive space.
Definition: space.hh:350
HRefinement(AdaptiveSpace< F, AdaptiveAdjustP< dim > > &spc)
Constructor.
Definition: hpMethod.hh:150
AdaptiveControlP()
Constructor.
Definition: hpMethod.hh:34
AdaptiveAdjustP(const Level< dim > &l, const int p)
Constructor.
Definition: hpMethod.hh:101
Abstract class for per cell postprocessing.
Definition: postProcess.hh:38
Basic namespace for Concepts-2.
Definition: pml_formula.h:16
Page URL: http://wiki.math.ethz.ch/bin/view/Concepts/WebHome
21 August 2020
© 2020 Eidgenössische Technische Hochschule Zürich