16 #ifndef __H2D_SOLUTION_H
17 #define __H2D_SOLUTION_H
19 #include "../function/mesh_function.h"
20 #include "../space/space.h"
21 #include "../mesh/refmap.h"
22 #include "exceptions.h"
74 template<
typename Scalar>
75 class HERMES_API Solution :
76 public MeshFunction<Scalar>,
77 public Hermes2D::Mixins::XMLParsing
81 Solution(MeshSharedPtr mesh);
82 Solution(SpaceSharedPtr<Scalar> s, Vector<Scalar>* coeff_vec);
83 Solution(SpaceSharedPtr<Scalar> s, Scalar* coeff_vec);
87 virtual bool isOkay()
const;
88 virtual inline std::string getClassName()
const {
return "Solution"; }
90 virtual void copy(
const MeshFunction<Scalar>* sln);
93 void set_dirichlet_lift(SpaceSharedPtr<Scalar> space);
97 virtual void save(
const char* filename)
const;
99 virtual void save_bson(
const char* filename)
const;
104 void load(
const char* filename, SpaceSharedPtr<Scalar> space);
106 void load_bson(
const char* filename, SpaceSharedPtr<Scalar> space);
113 Scalar get_ref_value(Element* e,
double xi1,
double xi2,
int component = 0,
int item = 0);
120 Scalar get_ref_value_transformed(Element* e,
double xi1,
double xi2,
int a,
int b);
126 Scalar** get_ref_values_transformed(Element* e,
double x,
double y);
133 virtual Func<Scalar>* get_pt_value(
double x,
double y,
bool use_MeshHashGrid =
false, Element* e =
nullptr);
137 virtual void add(MeshFunctionSharedPtr<Scalar>& other_mesh_function, SpaceSharedPtr<Scalar> target_space);
140 virtual void multiply(Scalar coef);
143 inline SolutionType
get_type()
const {
return sln_type; };
145 inline SpaceType get_space_type()
const {
return space_type; };
148 virtual void set_active_element(Element* e);
150 virtual MeshFunction<Scalar>* clone()
const;
152 void set_type(SolutionType
type) { sln_type =
type; };
168 void enable_transform(
bool enable =
true);
173 virtual void set_coeff_vector(
SpaceSharedPtr<Scalar> space,
const Vector<Scalar>* vec,
bool add_dir_lift,
int start_index);
175 virtual void set_coeff_vector(
SpaceSharedPtr<Scalar> space,
const Scalar* coeffs,
bool add_dir_lift,
int start_index);
177 SolutionType sln_type;
178 SpaceType space_type;
183 int* elem_coeffs[H2D_MAX_SOLUTION_COMPONENTS];
184 int num_coeffs, num_elems;
187 void transform_values(
int order,
int mask,
int np);
189 virtual void precalculate(
unsigned short order,
unsigned short mask);
191 Scalar* dxdy_coeffs[H2D_MAX_SOLUTION_COMPONENTS][H2D_NUM_FUNCTION_VALUES];
195 double** calc_mono_matrix(
int mode,
unsigned char o);
197 void init_dxdy_buffer();
200 void check_space_type_compliance(
const char* space_type_to_check)
const;
204 double x_real,
double y_real,
double x_complex,
double y_complex);
207 Scalar x[H2D_MAX_INTEGRATION_POINTS_COUNT], y[H2D_MAX_INTEGRATION_POINTS_COUNT], tx[H2D_MAX_INTEGRATION_POINTS_COUNT];
209 #pragma region friends
214 template<
typename T>
friend class OGProjectionNOX;
215 template<
typename T>
friend class Adapt;
216 template<
typename T>
friend class Func;
227 #pragma region static
229 static bool static_verbose_output;
232 static void make_dx_coeffs(
int mode,
int o, Scalar* mono, Scalar* result);
234 static void make_dy_coeffs(
int mode,
int o, Scalar* mono, Scalar* result);
236 static void set_static_verbose_output(
bool verbose);
239 static void vector_to_solutions(
const Scalar* solution_vector, std::vector<
SpaceSharedPtr<Scalar> > spaces,
241 std::vector<bool> add_dir_lift = std::vector<bool>(),
242 std::vector<int> start_indices = std::vector<int>());
245 bool add_dir_lift =
true,
int start_index = 0);
248 bool add_dir_lift =
true,
int start_index = 0);
252 std::vector<bool> add_dir_lift = std::vector<bool>(),
253 std::vector<int> start_indices = std::vector<int>());
255 static void vector_to_solutions_common_dir_lift(
const Vector<Scalar>* vec, std::vector<
SpaceSharedPtr<Scalar> > spaces,
257 bool add_dir_lift =
false);
259 static void vector_to_solutions_common_dir_lift(
const Scalar* solution_vector, std::vector<
SpaceSharedPtr<Scalar> > spaces,
261 bool add_dir_lift =
false);
264 bool add_dir_lift =
true,
int start_index = 0);
A projection-based selector for Hcurl space.
This class represents a function with jump discontinuity on an interface of two elements.
Scalar * mono_coeffs
Monomial coefficient array.
Used to pass the instances of Space around.
A projection-based selector for H1 space.
::xsd::cxx::tree::type type
C++ type corresponding to the anyType XML Schema built-in type.
A general projection-based selector.
Visualizes the basis functions of a space.
SolutionType get_type() const
Returns solution type.
::xsd::cxx::tree::string< char, simple_type > string
C++ type corresponding to the string XML Schema built-in type.
Represents the reference mapping.
Provides methods of integration order calculation.
This class characterizes a neighborhood of a given edge in terms of adjacent elements and provides me...
A projection-based selector for L2 space.
Represents the solution of a PDE.