Hermes2D  3.0
candidates.h
1 // This file is part of Hermes2D.
2 //
3 // Hermes2D is free software: you can redistribute it and/or modify
4 // it under the terms of the GNU General Public License as published by
5 // the Free Software Foundation, either version 2 of the License, or
6 // (at your option) any later version.
7 //
8 // Hermes2D is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License
14 // along with Hermes2D. If not, see <http://www.gnu.org/licenses/>.
15 
16 #ifndef __H2D_CANDIDATES_H
17 #define __H2D_CANDIDATES_H
18 
19 #include <ostream>
20 #include "global.h"
21 #include "refinement_selectors/element_to_refine.h"
22 
23 namespace Hermes
24 {
25  namespace Hermes2D
26  {
28 
30  extern HERMES_API bool is_refin_aniso(const RefinementType refin_type);
31 
33 
35  extern HERMES_API int get_refin_sons(const RefinementType refin_type);
36 
38 
41  extern HERMES_API const std::string get_refin_str(const RefinementType refin_type);
42 
43  namespace RefinementSelectors
44  {
46  enum CandList {
56  };
57 
59 
62  extern HERMES_API const char* get_cand_list_str(const CandList cand_list);
63 
65 
67  extern HERMES_API bool is_hp(const CandList cand_list);
68 
70 
72  extern HERMES_API bool is_p(const CandList cand_list);
73 
75 
77  extern HERMES_API bool is_p_aniso(const CandList cand_list);
78 
80  class HERMES_API Cand
81  {
82  public:
84  double error;
86  double errors[H2D_MAX_ELEMENT_SONS];
88  unsigned short dofs;
92  unsigned short p[H2D_MAX_ELEMENT_SONS];
94  double score;
95 
97 
99  Cand(const RefinementType split, const unsigned short order_elems[H2D_MAX_ELEMENT_SONS]);
100 
102 
107  Cand(const RefinementType split, const unsigned short order_elem0, const unsigned short order_elem1 = 0, const unsigned short order_elem2 = 0, const unsigned short order_elem3 = 0);
108 
110 
111  unsigned char get_num_elems() const;
112  };
113  }
114  }
115 }
116 
117 #endif
RefinementType split
A refinement, see the enum RefinementType.
Definition: candidates.h:90
HERMES_API bool is_p_aniso(const CandList cand_list)
Returns true if a predefined candidate list may contain candidates with an anisotropic change of orde...
Definition: candidates.cpp:62
Definition: adapt.h:24
P-candidates only. Hermes::Orders are modified non-uniformly.
Definition: candidates.h:49
H-candidates only. Hermes::Orders are not modified.
Definition: candidates.h:50
HERMES_API const char * get_cand_list_str(const CandList cand_list)
Returns a string representation of a predefined candidate list.
Definition: candidates.cpp:9
double error
Error of this candidate's sons.
Definition: candidates.h:84
RefinementType
Possible refinements of an element.
HERMES_API bool is_hp(const CandList cand_list)
Returns true if a predefined candidate list may contain candidates that are HP.
Definition: candidates.cpp:28
Common definitions for Hermes2D.
H-, ANISO- and P-candidates. Hermes::Orders are modified non-uniformly.
Definition: candidates.h:55
HERMES_API const std::string get_refin_str(const RefinementType refin_type)
Returns a string representation of the refinement.
H- and ANISO-candidates only. Hermes::Orders are not modified.
Definition: candidates.h:51
CandList
Predefined list of candidates.
Definition: candidates.h:46
H- and P-candidates only. Hermes::Orders are modified non-uniformly.
Definition: candidates.h:54
H- and P-candidates only. Hermes::Orders are modified uniformly.
Definition: candidates.h:52
unsigned short dofs
An estimated number of DOFs.
Definition: candidates.h:88
No adaptivity. (Used only in modules.)
Definition: candidates.h:47
HERMES_API bool is_p(const CandList cand_list)
Returns true if a predefined candidate list may contain candidates that increase P.
Definition: candidates.cpp:45
::xsd::cxx::tree::string< char, simple_type > string
C++ type corresponding to the string XML Schema built-in type.
HERMES_API int get_refin_sons(const RefinementType refin_type)
Returns a maximum number of sons that will be generated if a given refinement is applied.
#define H2D_MAX_ELEMENT_SONS
Macros.
Definition: global.h:30
H-, ANISO- and P-candidates. Hermes::Orders are modified uniformly.
Definition: candidates.h:53
double score
A score of a candidate: the higher the better. If zero, the score is not valid and a candidate should...
Definition: candidates.h:94
P-candidates only. Hermes::Orders are modified uniformly.
Definition: candidates.h:48
HERMES_API bool is_refin_aniso(const RefinementType refin_type)
Retuns true if a given refinement is an ANISO-refinement.