oomph::DummyErrorEstimator Class Reference

#include <error_estimator.h>

+ Inheritance diagram for oomph::DummyErrorEstimator:

Public Member Functions

 DummyErrorEstimator (Mesh *mesh_pt, const Vector< unsigned > &elements_to_refine, const unsigned &central_node_number, const bool &use_lagrangian_coordinates=false)
 
 DummyErrorEstimator (Mesh *mesh_pt, const Vector< double > &lower_left, const Vector< double > &upper_right, const unsigned &central_node_number, const bool &use_lagrangian_coordinates=false)
 
 DummyErrorEstimator (const DummyErrorEstimator &)=delete
 Broken copy constructor. More...
 
void operator= (const DummyErrorEstimator &)=delete
 Broken assignment operator. More...
 
virtual ~DummyErrorEstimator ()
 Empty virtual destructor. More...
 
virtual void get_element_errors (Mesh *&mesh_pt, Vector< double > &elemental_error, DocInfo &doc_info)
 
- Public Member Functions inherited from oomph::ErrorEstimator
 ErrorEstimator ()
 Default empty constructor. More...
 
 ErrorEstimator (const ErrorEstimator &)=delete
 Broken copy constructor. More...
 
void operator= (const ErrorEstimator &)=delete
 Broken assignment operator. More...
 
virtual ~ErrorEstimator ()
 Empty virtual destructor. More...
 
void get_element_errors (Mesh *&mesh_pt, Vector< double > &elemental_error)
 

Private Attributes

bool Use_lagrangian_coordinates
 
unsigned Central_node_number
 
Vector< Vector< double > > Region_upp_bound
 Upper bounds for the coordinates of the refinement regions. More...
 
Vector< Vector< double > > Region_low_bound
 Lower bounds for the coordinates of the refinement regions. More...
 

Detailed Description

///////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// Dummy error estimator, allows manual specification of refinement pattern by forcing refinement in regions defined by elements in a reference mesh.

Constructor & Destructor Documentation

◆ DummyErrorEstimator() [1/3]

oomph::DummyErrorEstimator::DummyErrorEstimator ( Mesh mesh_pt,
const Vector< unsigned > &  elements_to_refine,
const unsigned central_node_number,
const bool use_lagrangian_coordinates = false 
)
inline

Constructor. Provide mesh and number of the elements that define the regions within which elements are to be refined subsequently. Also specify the node number of a central node within elements – it's used to determine if an element is in the region where refinement is supposed to take place. Optional boolean flag (defaulting to false) indicates that refinement decision is based on Lagrangian coordinates – only applicable to solid meshes.

449  : Use_lagrangian_coordinates(use_lagrangian_coordinates),
450  Central_node_number(central_node_number)
451  {
452 #ifdef PARANOID
453 #ifdef OOMPH_HAS_MPI
454  if (mesh_pt->is_mesh_distributed())
455  {
456  throw OomphLibError(
457  "Can't use this error estimator on distributed meshes!",
460  }
461 #endif
462 #endif
463 
464 #ifdef PARANOID
465  if (mesh_pt->nelement() == 0)
466  {
467  throw OomphLibError(
468  "Can't build error estimator if there are no elements in mesh\n",
471  }
472 #endif
473 
474  unsigned dim = mesh_pt->finite_element_pt(0)->node_pt(0)->ndim();
475  if (use_lagrangian_coordinates)
476  {
477  SolidNode* solid_nod_pt =
478  dynamic_cast<SolidNode*>(mesh_pt->finite_element_pt(0)->node_pt(0));
479  if (solid_nod_pt != 0)
480  {
481  dim = solid_nod_pt->nlagrangian();
482  }
483  }
484  unsigned nregion = elements_to_refine.size();
485  Region_low_bound.resize(nregion);
486  Region_upp_bound.resize(nregion);
487  for (unsigned e = 0; e < nregion; e++)
488  {
489  Region_low_bound[e].resize(dim, 1.0e20);
490  Region_upp_bound[e].resize(dim, -1.0e20);
491  FiniteElement* el_pt =
492  mesh_pt->finite_element_pt(elements_to_refine[e]);
493  unsigned nnod = el_pt->nnode();
494  for (unsigned j = 0; j < nnod; j++)
495  {
496  Node* nod_pt = el_pt->node_pt(j);
497  for (unsigned i = 0; i < dim; i++)
498  {
499  double x = nod_pt->x(i);
500  if (use_lagrangian_coordinates)
501  {
502  SolidNode* solid_nod_pt = dynamic_cast<SolidNode*>(nod_pt);
503  if (solid_nod_pt != 0)
504  {
505  x = solid_nod_pt->xi(i);
506  }
507  }
508  if (x < Region_low_bound[e][i])
509  {
510  Region_low_bound[e][i] = x;
511  }
512  if (x > Region_upp_bound[e][i])
513  {
514  Region_upp_bound[e][i] = x;
515  }
516  }
517  }
518  }
519  }
int i
Definition: BiCGSTAB_step_by_step.cpp:9
Array< double, 1, 3 > e(1./3., 0.5, 2.)
bool Use_lagrangian_coordinates
Definition: error_estimator.h:631
Vector< Vector< double > > Region_low_bound
Lower bounds for the coordinates of the refinement regions.
Definition: error_estimator.h:641
Vector< Vector< double > > Region_upp_bound
Upper bounds for the coordinates of the refinement regions.
Definition: error_estimator.h:638
unsigned Central_node_number
Definition: error_estimator.h:635
list x
Definition: plotDoE.py:28
#define OOMPH_EXCEPTION_LOCATION
Definition: oomph_definitions.h:61
#define OOMPH_CURRENT_FUNCTION
Definition: oomph_definitions.h:86
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2

References e(), oomph::Mesh::finite_element_pt(), i, oomph::Mesh::is_mesh_distributed(), j, oomph::Node::ndim(), oomph::Mesh::nelement(), oomph::SolidNode::nlagrangian(), oomph::FiniteElement::nnode(), oomph::FiniteElement::node_pt(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, Region_low_bound, Region_upp_bound, plotDoE::x, oomph::Node::x(), and oomph::SolidNode::xi().

◆ DummyErrorEstimator() [2/3]

oomph::DummyErrorEstimator::DummyErrorEstimator ( Mesh mesh_pt,
const Vector< double > &  lower_left,
const Vector< double > &  upper_right,
const unsigned central_node_number,
const bool use_lagrangian_coordinates = false 
)
inline

Constructor. Provide vectors to "lower left" and "upper right" vertices of refinement region Also specify the node number of a central node within elements – it's used to determine if an element is in the region where refinement is supposed to take place. Optional boolean flag (defaulting to false) indicates that refinement decision is based on Lagrangian coordinates – only applicable to solid meshes.

535  : Use_lagrangian_coordinates(use_lagrangian_coordinates),
536  Central_node_number(central_node_number)
537  {
538 #ifdef PARANOID
539  if (mesh_pt->nelement() == 0)
540  {
541  throw OomphLibError(
542  "Can't build error estimator if there are no elements in mesh\n",
545  }
546 #endif
547 
548  unsigned nregion = 1;
549  Region_low_bound.resize(nregion);
550  Region_upp_bound.resize(nregion);
551  Region_low_bound[0] = lower_left;
552  Region_upp_bound[0] = upper_right;
553  }

References oomph::Mesh::nelement(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, Region_low_bound, and Region_upp_bound.

◆ DummyErrorEstimator() [3/3]

oomph::DummyErrorEstimator::DummyErrorEstimator ( const DummyErrorEstimator )
delete

Broken copy constructor.

◆ ~DummyErrorEstimator()

virtual oomph::DummyErrorEstimator::~DummyErrorEstimator ( )
inlinevirtual

Empty virtual destructor.

562 {}

Member Function Documentation

◆ get_element_errors()

virtual void oomph::DummyErrorEstimator::get_element_errors ( Mesh *&  mesh_pt,
Vector< double > &  elemental_error,
DocInfo doc_info 
)
inlinevirtual

Compute the elemental error measures for a given mesh and store them in a vector. Doc errors etc.

Implements oomph::ErrorEstimator.

570  {
571 #ifdef PARANOID
572  if (doc_info.is_doc_enabled())
573  {
574  std::ostringstream warning_stream;
575  warning_stream
576  << "No output defined in DummyErrorEstimator::get_element_errors()\n"
577  << "Ignoring doc_info flag.\n";
578  OomphLibWarning(warning_stream.str(),
579  "DummyErrorEstimator::get_element_errors()",
581  }
582 #endif
583  unsigned nregion = Region_low_bound.size();
584  unsigned nelem = mesh_pt->nelement();
585  for (unsigned e = 0; e < nelem; e++)
586  {
587  elemental_error[e] = 0.0;
588 
589  // Check if element is in the regions to be refined
590  // (based on coords of its central node)
591  Node* nod_pt =
592  mesh_pt->finite_element_pt(e)->node_pt(Central_node_number);
593  for (unsigned r = 0; r < nregion; r++)
594  {
595  bool is_inside = true;
596  unsigned dim = Region_low_bound[r].size();
597  for (unsigned i = 0; i < dim; i++)
598  {
599  double x = nod_pt->x(i);
601  {
602  SolidNode* solid_nod_pt = dynamic_cast<SolidNode*>(nod_pt);
603  if (solid_nod_pt != 0)
604  {
605  x = solid_nod_pt->xi(i);
606  }
607  }
608  if (x < Region_low_bound[r][i])
609  {
610  is_inside = false;
611  break;
612  }
613  if (x > Region_upp_bound[r][i])
614  {
615  is_inside = false;
616  break;
617  }
618  }
619  if (is_inside)
620  {
621  elemental_error[e] = 1.0;
622  break;
623  }
624  }
625  }
626  }
r
Definition: UniformPSDSelfTest.py:20

References Central_node_number, e(), oomph::Mesh::finite_element_pt(), i, oomph::DocInfo::is_doc_enabled(), oomph::Mesh::nelement(), oomph::FiniteElement::node_pt(), OOMPH_EXCEPTION_LOCATION, UniformPSDSelfTest::r, Region_low_bound, Region_upp_bound, Use_lagrangian_coordinates, plotDoE::x, oomph::Node::x(), and oomph::SolidNode::xi().

◆ operator=()

void oomph::DummyErrorEstimator::operator= ( const DummyErrorEstimator )
delete

Broken assignment operator.

Member Data Documentation

◆ Central_node_number

unsigned oomph::DummyErrorEstimator::Central_node_number
private

Number of local node that is used to identify if an element is located in the refinement region

Referenced by get_element_errors().

◆ Region_low_bound

Vector<Vector<double> > oomph::DummyErrorEstimator::Region_low_bound
private

Lower bounds for the coordinates of the refinement regions.

Referenced by DummyErrorEstimator(), and get_element_errors().

◆ Region_upp_bound

Vector<Vector<double> > oomph::DummyErrorEstimator::Region_upp_bound
private

Upper bounds for the coordinates of the refinement regions.

Referenced by DummyErrorEstimator(), and get_element_errors().

◆ Use_lagrangian_coordinates

bool oomph::DummyErrorEstimator::Use_lagrangian_coordinates
private

Use Lagrangian coordinates to decide which element is to be refined

Referenced by get_element_errors().


The documentation for this class was generated from the following file: