Hermes2D  3.0
exact_solution.cpp
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 #include "solution_h2d_xml.h"
17 #include "exact_solution.h"
18 #include "api2d.h"
19 #include "../weakform_library/weakforms_h1.h"
20 #include "space_h1.h"
21 #include "../solver/linear_solver.h"
22 
23 #ifdef WITH_BSON
24 #include "bson.h"
25 #endif
26 
27 namespace Hermes
28 {
29  namespace Hermes2D
30  {
31  template<typename Scalar>
32  ExactSolution<Scalar>::ExactSolution(MeshSharedPtr mesh) : Solution<Scalar>(mesh)
33  {
34  this->sln_type = HERMES_EXACT;
35  this->num_dofs = -1;
36  this->exact_multiplicator = 1.0;
37  }
38 
39  template<typename Scalar>
40  void ExactSolution<Scalar>::save(const char* filename) const
41  {
42  if (this->sln_type == HERMES_SLN)
43  {
44  Solution<Scalar>::save(filename);
45  return;
46  }
47 
48  throw Exceptions::Exception("Arbitrary exact solution can not be saved to disk. Only constant one can. Project to a space to get a saveable solution.");
49  }
50 
51 #ifdef WITH_BSON
52  template<typename Scalar>
53  void ExactSolution<Scalar>::save_bson(const char* filename) const
54  {
55  if (this->sln_type == HERMES_SLN)
56  {
58  return;
59  }
60 
61  throw Exceptions::Exception("Arbitrary exact solution can not be saved to disk. Only constant one can. Project to a space to get a saveable solution.");
62  }
63 #endif
64 
65  template<typename Scalar>
67  {
68  throw Hermes::Exceptions::Exception("Solution<Scalar>::clone() must be overridden in the case of exact solutions.");
69  return nullptr;
70  }
71 
72  template<typename Scalar>
74  {
75  return "ExactSolution";
76  }
77 
78  template<typename Scalar>
79  ExactSolutionScalar<Scalar>::ExactSolutionScalar(MeshSharedPtr mesh) : ExactSolution<Scalar>(mesh)
80  {
81  this->num_components = 1;
82  }
83 
84  template<typename Scalar>
86  {
87  return 1;
88  }
89 
90  template<typename Scalar, typename ValueType>
91  ExactSolutionConstantArray<Scalar, ValueType>::ExactSolutionConstantArray(MeshSharedPtr mesh, ValueType* valueArray, bool deleteArray) : ExactSolutionScalar<Scalar>(mesh), valueArray(valueArray), deleteArray(deleteArray)
92  {
93  }
94 
95  template<typename Scalar, typename ValueType>
97  {
98  if (this->deleteArray)
99  free_with_check(this->valueArray);
100  }
101 
102  template<typename Scalar, typename ValueType>
104  {
105  return new ExactSolutionConstantArray<Scalar, ValueType>(this->mesh, this->valueArray);
106  }
107 
108  template<typename Scalar, typename ValueType>
110  {
111  return this->valueArray[this->element->id];
112  }
113 
114  template<typename Scalar, typename ValueType>
116  return Ord(0);
117  }
118 
119  template<typename Scalar, typename ValueType>
121  {
122  valueArray = valueArray;
123  }
124 
125  template<typename Scalar, typename ValueType>
126  void ExactSolutionConstantArray<Scalar, ValueType>::derivatives(double x, double y, Scalar& dx, Scalar& dy) const {
127  dx = 0;
128  dy = 0;
129  };
130 
131  template<typename Scalar>
132  ExactSolutionVector<Scalar>::ExactSolutionVector(MeshSharedPtr mesh) : ExactSolution<Scalar>(mesh)
133  {
134  this->num_components = 2;
135  }
136 
137  template<typename Scalar>
139  {
140  return 2;
141  }
142 
143  template<>
144  void ConstantSolution<double>::save(const char* filename) const
145  {
146  if (this->sln_type == HERMES_SLN)
147  {
148  Solution<double>::save(filename);
149  return;
150  }
151  try
152  {
153  XMLSolution::solution xmlsolution(1, 0, 0, 1, 0);
154 
155  xmlsolution.exactCXR() = this->constant;
156 
157  std::string solution_schema_location(Hermes2DApi.get_text_param_value(xmlSchemasDirPath));
158  solution_schema_location.append("/solution_h2d_xml.xsd");
159  ::xml_schema::namespace_info namespace_info_solution("XMLSolution", solution_schema_location);
160 
161  ::xml_schema::namespace_infomap namespace_info_map;
162  namespace_info_map.insert(std::pair<std::basic_string<char>, xml_schema::namespace_info>("solution", namespace_info_solution));
163 
164  std::ofstream out(filename);
165  ::xml_schema::flags parsing_flags = ::xml_schema::flags::dont_pretty_print;
166  XMLSolution::solution_(out, xmlsolution, namespace_info_map, "UTF-8", parsing_flags);
167 
168  out.close();
169  }
170  catch (const xml_schema::exception& e)
171  {
172  throw Hermes::Exceptions::SolutionSaveFailureException(e.what());
173  }
174  }
175 
176  template<>
177  void ConstantSolution<std::complex<double> >::save(const char* filename) const
178  {
179  if (this->sln_type == HERMES_SLN)
180  {
181  Solution<std::complex<double> >::save(filename);
182  return;
183  }
184  try
185  {
186  XMLSolution::solution xmlsolution(1, 0, 0, 1, 1);
187 
188  xmlsolution.exactCXR() = this->constant.real();
189  xmlsolution.exactCXC() = this->constant.imag();
190 
191  std::string solution_schema_location(Hermes2DApi.get_text_param_value(xmlSchemasDirPath));
192  solution_schema_location.append("/solution_h2d_xml.xsd");
193  ::xml_schema::namespace_info namespace_info_solution("XMLSolution", solution_schema_location);
194 
195  ::xml_schema::namespace_infomap namespace_info_map;
196  namespace_info_map.insert(std::pair<std::basic_string<char>, xml_schema::namespace_info>("solution", namespace_info_solution));
197 
198  std::ofstream out(filename);
199  ::xml_schema::flags parsing_flags = ::xml_schema::flags::dont_pretty_print;
200  XMLSolution::solution_(out, xmlsolution, namespace_info_map, "UTF-8", parsing_flags);
201  out.close();
202  }
203  catch (const xml_schema::exception& e)
204  {
205  throw Hermes::Exceptions::SolutionSaveFailureException(e.what());
206  }
207  }
208 
209 #ifdef WITH_BSON
210  template<>
211  void ConstantSolution<double>::save_bson(const char* filename) const
212  {
213  if (this->sln_type == HERMES_SLN)
214  {
215  Solution<double>::save_bson(filename);
216  return;
217  }
218 
219  // bson
220  bson bw;
221  bson_init(&bw);
222 
223  bson_append_bool(&bw, "exact", true);
224  bson_append_bool(&bw, "complex", false);
225 
226  bson_append_start_array(&bw, "values");
227  bson_append_double(&bw, "c", this->constant);
228  bson_append_double(&bw, "c", 0.);
229  bson_append_double(&bw, "c", 0.);
230  bson_append_double(&bw, "c", 0.);
231  bson_append_finish_array(&bw);
232 
233  bson_append_int(&bw, "components_count", this->num_components);
234 
235  bson_finish(&bw);
236 
237  FILE *fpw;
238  fpw = fopen(filename, "wb");
239  const char *dataw = (const char *)bson_data(&bw);
240  fwrite(dataw, bson_size(&bw), 1, fpw);
241  fclose(fpw);
242 
243  bson_destroy(&bw);
244  }
245 
246  template<>
247  void ConstantSolution<std::complex<double> >::save_bson(const char* filename) const
248  {
249  if (this->sln_type == HERMES_SLN)
250  {
251  Solution<std::complex<double> >::save_bson(filename);
252  return;
253  }
254 
255  // bson
256  bson bw;
257  bson_init(&bw);
258 
259  bson_append_bool(&bw, "exact", true);
260  bson_append_bool(&bw, "complex", true);
261 
262  bson_append_start_array(&bw, "values");
263  bson_append_double(&bw, "c", this->constant.real());
264  bson_append_double(&bw, "c", 0.);
265  bson_append_double(&bw, "c", this->constant.imag());
266  bson_append_double(&bw, "c", 0.);
267  bson_append_finish_array(&bw);
268 
269  bson_append_int(&bw, "components_count", this->num_components);
270 
271  bson_finish(&bw);
272 
273  FILE *fpw;
274  fpw = fopen(filename, "wb");
275  const char *dataw = (const char *)bson_data(&bw);
276  fwrite(dataw, bson_size(&bw), 1, fpw);
277  fclose(fpw);
278 
279  bson_destroy(&bw);
280  }
281 #endif
282 
283  template<typename Scalar>
284  ConstantSolution<Scalar>::ConstantSolution(MeshSharedPtr mesh, Scalar constant) : ExactSolutionScalar<Scalar>(mesh), constant(constant)
285  {
286  this->order = 0;
287  };
288 
289  template<typename Scalar>
290  Scalar ConstantSolution<Scalar>::value(double x, double y) const {
291  return constant;
292  };
293 
294  template<typename Scalar>
296  {
297  if (this->sln_type == HERMES_SLN)
298  return Solution<Scalar>::clone();
299  return new ConstantSolution<Scalar>(this->mesh, this->constant);
300  }
301 
302  template<typename Scalar>
303  void ConstantSolution<Scalar>::derivatives(double x, double y, Scalar& dx, Scalar& dy) const {
304  dx = 0;
305  dy = 0;
306  };
307 
308  template<typename Scalar>
309  Ord ConstantSolution<Scalar>::ord(double x, double y) const {
310  return Ord(0);
311  }
312 
313  template<typename Scalar>
314  ZeroSolution<Scalar>::ZeroSolution(MeshSharedPtr mesh) : ExactSolutionScalar<Scalar>(mesh)
315  {
316  this->order = 0;
317  };
318 
319  template<typename Scalar>
320  Scalar ZeroSolution<Scalar>::value(double x, double y) const {
321  return 0.0;
322  };
323 
324  template<typename Scalar>
326  {
327  if (this->sln_type == HERMES_SLN)
328  return Solution<Scalar>::clone();
329  return new ZeroSolution<Scalar>(this->mesh);
330  }
331 
332  template<typename Scalar>
333  void ZeroSolution<Scalar>::derivatives(double x, double y, Scalar& dx, Scalar& dy) const {
334  dx = 0;
335  dy = 0;
336  };
337 
338  template<typename Scalar>
339  Ord ZeroSolution<Scalar>::ord(double x, double y) const {
340  return Ord(0);
341  }
342 
343  template<>
344  void ConstantSolutionVector<double>::save(const char* filename) const
345  {
346  if (this->sln_type == HERMES_SLN)
347  {
348  Solution<double>::save(filename);
349  return;
350  }
351  try
352  {
353  XMLSolution::solution xmlsolution(2, 0, 0, 1, 0);
354 
355  xmlsolution.exactCXR() = this->constantX;
356  xmlsolution.exactCYR() = this->constantY;
357 
358  std::string solution_schema_location(Hermes2DApi.get_text_param_value(xmlSchemasDirPath));
359  solution_schema_location.append("/solution_h2d_xml.xsd");
360  ::xml_schema::namespace_info namespace_info_solution("XMLSolution", solution_schema_location);
361 
362  ::xml_schema::namespace_infomap namespace_info_map;
363  namespace_info_map.insert(std::pair<std::basic_string<char>, xml_schema::namespace_info>("solution", namespace_info_solution));
364 
365  std::ofstream out(filename);
366  ::xml_schema::flags parsing_flags = ::xml_schema::flags::dont_pretty_print;
367  XMLSolution::solution_(out, xmlsolution, namespace_info_map, "UTF-8", parsing_flags);
368  out.close();
369  }
370  catch (const xml_schema::exception& e)
371  {
372  throw Hermes::Exceptions::SolutionSaveFailureException(e.what());
373  }
374  }
375 
376  template<>
377  void ConstantSolutionVector<std::complex<double> >::save(const char* filename) const
378  {
379  if (this->sln_type == HERMES_SLN)
380  {
381  Solution<std::complex<double> >::save(filename);
382  return;
383  }
384  try
385  {
386  XMLSolution::solution xmlsolution(2, 0, 0, 1, 1);
387 
388  xmlsolution.exactCXR() = this->constantX.real();
389  xmlsolution.exactCXC() = this->constantX.imag();
390  xmlsolution.exactCYR() = this->constantY.real();
391  xmlsolution.exactCYC() = this->constantY.imag();
392 
393  std::string solution_schema_location(Hermes2DApi.get_text_param_value(xmlSchemasDirPath));
394  solution_schema_location.append("/solution_h2d_xml.xsd");
395  ::xml_schema::namespace_info namespace_info_solution("XMLSolution", solution_schema_location);
396 
397  ::xml_schema::namespace_infomap namespace_info_map;
398  namespace_info_map.insert(std::pair<std::basic_string<char>, xml_schema::namespace_info>("solution", namespace_info_solution));
399 
400  std::ofstream out(filename);
401 
402  ::xml_schema::flags parsing_flags = ::xml_schema::flags::dont_pretty_print;
403 
404  XMLSolution::solution_(out, xmlsolution, namespace_info_map, "UTF-8", parsing_flags);
405 
406  out.close();
407  }
408  catch (const xml_schema::exception& e)
409  {
410  throw Hermes::Exceptions::SolutionSaveFailureException(e.what());
411  }
412  }
413 
414  template<typename Scalar>
415  ConstantSolutionVector<Scalar>::ConstantSolutionVector(MeshSharedPtr mesh, Scalar constantX, Scalar constantY) : ExactSolutionVector<Scalar>(mesh), constantX(constantX), constantY(constantY)
416  {
417  this->order = 0;
418  };
419 
420  template<typename Scalar>
422  {
423  if (this->sln_type == HERMES_SLN)
424  return Solution<Scalar>::clone();
425  ConstantSolutionVector<Scalar>* sln = new ConstantSolutionVector<Scalar>(this->mesh, this->constantX, this->constantY);
426  return sln;
427  }
428 
429  template<typename Scalar>
430  Scalar2<Scalar> ConstantSolutionVector<Scalar>::value(double x, double y) const {
431  return Scalar2<Scalar>(constantX, constantY);
432  };
433 
434  template<typename Scalar>
435  void ConstantSolutionVector<Scalar>::derivatives(double x, double y, Scalar2<Scalar>& dx, Scalar2<Scalar>& dy) const {
436  dx = Scalar2<Scalar>(Scalar(0.0), Scalar(0.0));
437  dy = Scalar2<Scalar>(Scalar(0.0), Scalar(0.0));
438  };
439 
440  template<typename Scalar>
441  Ord ConstantSolutionVector<Scalar>::ord(double x, double y) const {
442  return Ord(0);
443  }
444 
445 #ifdef WITH_BSON
446  template<>
447  void ConstantSolutionVector<double>::save_bson(const char* filename) const
448  {
449  if (this->sln_type == HERMES_SLN)
450  {
451  Solution<double>::save_bson(filename);
452  return;
453  }
454 
455  // bson
456  bson bw;
457  bson_init(&bw);
458 
459  bson_append_bool(&bw, "exact", true);
460  bson_append_bool(&bw, "complex", false);
461 
462  bson_append_start_array(&bw, "values");
463  bson_append_double(&bw, "c", this->constantX);
464  bson_append_double(&bw, "c", this->constantY);
465  bson_append_double(&bw, "c", 0.);
466  bson_append_double(&bw, "c", 0.);
467  bson_append_finish_array(&bw);
468 
469  bson_append_int(&bw, "components_count", this->num_components);
470 
471  bson_finish(&bw);
472 
473  FILE *fpw;
474  fpw = fopen(filename, "wb");
475  const char *dataw = (const char *)bson_data(&bw);
476  fwrite(dataw, bson_size(&bw), 1, fpw);
477  fclose(fpw);
478 
479  bson_destroy(&bw);
480  }
481 
482  template<>
483  void ConstantSolutionVector<std::complex<double> >::save_bson(const char* filename) const
484  {
485  if (this->sln_type == HERMES_SLN)
486  {
487  Solution<std::complex<double> >::save_bson(filename);
488  return;
489  }
490 
491  // bson
492  bson bw;
493  bson_init(&bw);
494 
495  bson_append_bool(&bw, "exact", true);
496  bson_append_bool(&bw, "complex", true);
497 
498  bson_append_start_array(&bw, "values");
499  bson_append_double(&bw, "c", this->constantX.real());
500  bson_append_double(&bw, "c", this->constantY.real());
501  bson_append_double(&bw, "c", this->constantX.imag());
502  bson_append_double(&bw, "c", this->constantY.imag());
503  bson_append_finish_array(&bw);
504 
505  bson_append_int(&bw, "components_count", this->num_components);
506 
507  bson_finish(&bw);
508 
509  FILE *fpw;
510  fpw = fopen(filename, "wb");
511  const char *dataw = (const char *)bson_data(&bw);
512  fwrite(dataw, bson_size(&bw), 1, fpw);
513  fclose(fpw);
514 
515  bson_destroy(&bw);
516  }
517 #endif
518 
519  template<typename Scalar>
520  ZeroSolutionVector<Scalar>::ZeroSolutionVector(MeshSharedPtr mesh) : ExactSolutionVector<Scalar>(mesh)
521  {
522  this->order = 0;
523  };
524 
525  template<typename Scalar>
526  Scalar2<Scalar> ZeroSolutionVector<Scalar>::value(double x, double y) const {
527  return Scalar2<Scalar>(0.0, 0.0);
528  };
529 
530  template<typename Scalar>
531  void ZeroSolutionVector<Scalar>::derivatives(double x, double y, Scalar2<Scalar>& dx, Scalar2<Scalar>& dy) const {
532  dx = Scalar2<Scalar>(0.0, 0.0);
533  dy = Scalar2<Scalar>(0.0, 0.0);
534  };
535 
536  template<typename Scalar>
537  Ord ZeroSolutionVector<Scalar>::ord(double x, double y) const {
538  return Ord(0);
539  }
540 
541  template<typename Scalar>
543  {
544  if (this->sln_type == HERMES_SLN)
545  return Solution<Scalar>::clone();
547  return sln;
548  }
549 
550  ExactSolutionEggShell::ExactSolutionEggShell(MeshSharedPtr mesh, int polynomialOrder) : ExactSolutionScalar<double>(mesh)
551  {
553  std::vector<EssentialBoundaryCondition<double>*> bcVector;
554  bcVector.push_back(new DefaultEssentialBCConst<double>(EggShell::eggShell0Marker, 0.));
555  bcVector.push_back(new DefaultEssentialBCConst<double>(EggShell::eggShell1Marker, 1.));
556  EssentialBCs<double> bcs(bcVector);
557  SpaceSharedPtr<double> space(new H1Space<double>(mesh, &bcs, polynomialOrder));
558  Hermes::Hermes2D::LinearSolver<double> linear_solver(wf, space);
560  linear_solver.solve();
561  Solution<double>::vector_to_solution(linear_solver.get_sln_vector(), space, sln);
562  this->copy(sln.get());
563  }
564 
565  double ExactSolutionEggShell::value(double x, double y) const
566  {
567  throw Exceptions::Exception("ExactSolutionEggShell::value should never be called.");
568  return 0.;
569  }
570 
571  void ExactSolutionEggShell::derivatives(double x, double y, double& dx, double& dy) const
572  {
573  throw Exceptions::Exception("ExactSolutionEggShell::derivatives should never be called.");
574  }
575 
576  Hermes::Ord ExactSolutionEggShell::ord(double x, double y) const
577  {
578  throw Exceptions::Exception("ExactSolutionEggShell::ord should never be called.");
579  return Hermes::Ord(0);
580  }
581 
583  {
585  sln->copy(this);
586  return sln;
587  }
588 
589  template<typename Scalar>
591  {
592  this->num_components = 1;
593  this->set_quad_2d(&g_quad_2d_std);
594  }
595 
596  template<typename Scalar>
597  Func<Scalar>* UExtFunction<Scalar>::get_pt_value(double x, double y, bool use_MeshHashGrid, Element* e)
598  {
599  throw Exceptions::Exception("UExtFunction is only usable in assembling, not for getting point values.");
600  return nullptr;
601  }
602 
603  template<typename Scalar>
604  void UExtFunction<Scalar>::precalculate(unsigned short order, unsigned short mask)
605  {
606  }
607 
608  template<typename Scalar>
610  {
611  }
612 
613  template<typename Scalar>
615  {
616  }
617 
618  template<typename Scalar>
619  UExtFunctionSharedPtr<Scalar>::UExtFunctionSharedPtr(const UExtFunctionSharedPtr& other) : std::tr1::shared_ptr<Hermes::Hermes2D::UExtFunction<Scalar> >(other)
620  {
621  }
622 
623  template<typename Scalar>
624  void UExtFunctionSharedPtr<Scalar>::operator=(const UExtFunctionSharedPtr& other)
625  {
626  std::tr1::shared_ptr<Hermes::Hermes2D::UExtFunction<Scalar> >::operator=(other);
627  }
628 
629  template class HERMES_API UExtFunctionSharedPtr < double > ;
630  template class HERMES_API UExtFunctionSharedPtr < std::complex<double> > ;
631 
632  template HERMES_API class ExactSolutionScalar < double > ;
633  template HERMES_API class ExactSolutionScalar < std::complex<double> > ;
634 
635  template HERMES_API class ExactSolutionConstantArray < double, double > ;
636  template HERMES_API class ExactSolutionConstantArray < double, int > ;
637  template HERMES_API class ExactSolutionConstantArray < double, unsigned int > ;
638  template HERMES_API class ExactSolutionConstantArray < double, bool > ;
639  template HERMES_API class ExactSolutionConstantArray < std::complex<double>, std::complex<double> > ;
640 
641  template HERMES_API class ExactSolutionVector < double > ;
642  template HERMES_API class ExactSolutionVector < std::complex<double> > ;
643  template HERMES_API class ConstantSolution < double > ;
644  template HERMES_API class ConstantSolution < std::complex<double> > ;
645  template HERMES_API class ConstantSolutionVector < double > ;
646  template HERMES_API class ConstantSolutionVector < std::complex<double> > ;
647  template HERMES_API class ZeroSolution < double > ;
648  template HERMES_API class ZeroSolution < std::complex<double> > ;
649  template HERMES_API class ZeroSolutionVector < double > ;
650  template HERMES_API class ZeroSolutionVector < std::complex<double> > ;
651 
652  template HERMES_API class UExtFunction < double > ;
653  template HERMES_API class UExtFunction < std::complex<double> > ;
654  }
655 }
virtual MeshFunction< Scalar > * clone() const
ExactSolutionConstantArray(MeshSharedPtr mesh, ValueType *valueArray, bool deleteArray=false)
Definition: adapt.h:24
void save(const char *filename) const
Saves the exact solution to an XML file.
void free(void)
Frees all precalculated tables.
virtual Ord ord(double x, double y) const
Function operating on previous nonlinear solutions in assembling (u_ext)
virtual void copy(const MeshFunction< double > *sln)
HERMES_API Hermes::Hermes2D::Api2D Hermes2DApi
Global instance used inside Hermes which is also accessible to users.
Definition: api2d.cpp:117
::xsd::cxx::tree::flags flags
Parsing and serialization flags.
Stores one element of a mesh.
Definition: element.h:107
Scalar * get_sln_vector()
Get sln vector.
virtual void save(const char *filename) const
Saves the exact solution to an XML file.
Represents a function defined on a mesh.
Definition: mesh_function.h:56
virtual Scalar value(double x, double y) const
Function returning the value.
virtual void derivatives(double x, double y, Scalar2< Scalar > &dx, Scalar2< Scalar > &dy) const
Function returning the derivatives.
::xsd::cxx::tree::exception< char > exception
Root of the C++/Tree exception hierarchy.
virtual double value(double x, double y) const
Function returning the value.
Used to pass the instances of Space around.
Definition: space.h:34
virtual Hermes::Ord ord(double x, double y) const
::std::auto_ptr< ::XMLSolution::solution > solution_(const ::std::string &uri,::xml_schema::flags f=0, const ::xml_schema::properties &p=::xml_schema::properties())
Parse a URI or a local file.
virtual void derivatives(double x, double y, Scalar &dx, Scalar &dy) const
Function returning the derivatives.
virtual void precalculate(unsigned short order, unsigned short mask)
precalculates the current function at the current integration points.
Class corresponding to the solution schema type.
ExactSolutionEggShell(MeshSharedPtr mesh, int polynomialOrder)
virtual MeshFunction< Scalar > * clone() const
virtual MeshFunction< Scalar > * clone() const
Definition: solution.cpp:220
virtual void derivatives(double x, double y, Scalar2< Scalar > &dx, Scalar2< Scalar > &dy) const
Function returning the derivatives.
virtual MeshFunction< Scalar > * clone() const
MeshFunction< double > * clone() const
::xsd::cxx::xml::dom::namespace_info< char > namespace_info
Namespace serialization information.
const exactCXR_optional & exactCXR() const
Return a read-only (constant) reference to the attribute container.
virtual unsigned int get_dimension() const
For Scalar-valued solutions this returns 1.
::xsd::cxx::xml::dom::namespace_infomap< char > namespace_infomap
Namespace serialization information map.
virtual void derivatives(double x, double y, double &dx, double &dy) const
Function returning the derivatives.
static const std::string eggShell0Marker
The mesh returned from get_egg_shell has this marker on the "0" boundary.
Definition: mesh.h:480
virtual void save(const char *filename) const
virtual void solve(Scalar *coeff_vec)
virtual MeshFunction< Scalar > * clone() const
Represents an arbitrary function defined on an element.
Definition: function.h:106
const exactCYR_optional & exactCYR() const
Return a read-only (constant) reference to the attribute container.
virtual Ord ord(double x, double y) const
Used to pass the instances of WeakForm around.
Definition: weakform.h:55
virtual void derivatives(double x, double y, Scalar &dx, Scalar &dy) const
Function returning the derivatives.
Represents an exact solution of a PDE.
virtual Ord ord(double x, double y) const
virtual MeshFunction< Scalar > * clone() const
static const std::string eggShell1Marker
The mesh returned from get_egg_shell has this marker on the "1" boundary.
Definition: mesh.h:478
virtual Scalar2< Scalar > value(double x, double y) const
Function returning the value.
::xsd::cxx::tree::string< char, simple_type > string
C++ type corresponding to the string XML Schema built-in type.
void save(const char *filename) const
Saves the exact solution to an XML file.
Generated from solution_h2d_xml.xsd.
virtual void derivatives(double x, double y, Scalar &dx, Scalar &dy) const
Function returning the derivatives.
virtual Scalar2< Scalar > value(double x, double y) const
Function returning the value.
unsigned char num_components
Number of vector components.
Definition: function.h:218
virtual Ord ord(double x, double y) const
const exactCXC_optional & exactCXC() const
Return a read-only (constant) reference to the attribute container.
virtual void set_quad_2d(Quad2D *quad_2d)
Selects the quadrature points in which the function will be evaluated.
Definition: function.cpp:79
virtual MeshFunction< Scalar > * clone() const
const exactCYC_optional & exactCYC() const
Return a read-only (constant) reference to the attribute container.
Class representing constant essential boundary condition.
virtual unsigned int get_dimension() const
For vector-valued solutions this returns 2.
Represents the solution of a PDE.
Definition: api2d.h:35
int order
Current function polynomial order.
Definition: function.h:215
virtual Ord ord(double x, double y) const
virtual Scalar value(double x, double y) const
Function returning the value.
virtual Scalar value(double x, double y) const
Function returning the value.