libMesh
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | Private Attributes | List of all members
libMesh::AutoAreaFunction Class Reference

#include <triangulator_interface.h>

Inheritance diagram for libMesh::AutoAreaFunction:
[legend]

Public Member Functions

 AutoAreaFunction (const Parallel::Communicator &comm, const unsigned int num_nearest_pts, const unsigned int power, const Real background_value, const Real background_eff_dist)
 
 AutoAreaFunction (const AutoAreaFunction &)
 
AutoAreaFunctionoperator= (const AutoAreaFunction &)
 
 AutoAreaFunction (AutoAreaFunction &&)=delete
 
AutoAreaFunctionoperator= (AutoAreaFunction &&)=delete
 
virtual ~AutoAreaFunction ()
 
void init_mfi (const std::vector< Point > &input_pts, const std::vector< Real > &input_vals)
 
virtual Real operator() (const Point &p, const Real) override
 
virtual void operator() (const Point &p, const Real time, DenseVector< Real > &output) override
 Evaluation function for time-dependent vector-valued functions.
 
virtual std::unique_ptr< FunctionBase< Real > > clone () const override
 
virtual void init ()
 The actual initialization process.
 
virtual void clear ()
 Clears the function.
 
void operator() (const Point &p, DenseVector< Real > &output)
 Evaluation function for time-independent vector-valued functions.
 
virtual Real component (unsigned int i, const Point &p, Real time=0.)
 
bool initialized () const
 
void set_is_time_dependent (bool is_time_dependent)
 Function to set whether this is a time-dependent function or not.
 
bool is_time_dependent () const
 

Protected Attributes

const FunctionBase_master
 Const pointer to our master, initialized to nullptr.
 
bool _initialized
 When init() was called so that everything is ready for calls to operator() (...), then this bool is true.
 
bool _is_time_dependent
 Cache whether or not this function is actually time-dependent.
 

Private Attributes

const Parallel::Communicator_comm
 
const unsigned int _num_nearest_pts
 
const unsigned int _power
 
const Real _background_value
 
const Real _background_eff_dist
 
std::unique_ptr< InverseDistanceInterpolation< 3 > > _auto_area_mfi
 

Detailed Description

Definition at line 45 of file triangulator_interface.h.

Constructor & Destructor Documentation

◆ AutoAreaFunction() [1/3]

libMesh::AutoAreaFunction::AutoAreaFunction ( const Parallel::Communicator comm,
const unsigned int  num_nearest_pts,
const unsigned int  power,
const Real  background_value,
const Real  background_eff_dist 
)

Definition at line 54 of file triangulator_interface.C.

58 :
59 _comm(comm),
60 _num_nearest_pts(num_nearest_pts),
61 _power(power),
62 _background_value(background_value),
63 _background_eff_dist(background_eff_dist),
65{
66 this->_initialized = false;
67 this->_is_time_dependent = false;
68}
std::unique_ptr< InverseDistanceInterpolation< 3 > > _auto_area_mfi
const Parallel::Communicator & _comm
bool _initialized
When init() was called so that everything is ready for calls to operator() (...), then this bool is t...
bool _is_time_dependent
Cache whether or not this function is actually time-dependent.
template class LIBMESH_EXPORT InverseDistanceInterpolation< 3 >

References libMesh::FunctionBase< Real >::_initialized, and libMesh::FunctionBase< Real >::_is_time_dependent.

◆ AutoAreaFunction() [2/3]

libMesh::AutoAreaFunction::AutoAreaFunction ( const AutoAreaFunction )

◆ AutoAreaFunction() [3/3]

libMesh::AutoAreaFunction::AutoAreaFunction ( AutoAreaFunction &&  )
delete

◆ ~AutoAreaFunction()

libMesh::AutoAreaFunction::~AutoAreaFunction ( )
virtualdefault

Member Function Documentation

◆ clear()

virtual void libMesh::FunctionBase< Real >::clear ( )
inlinevirtualinherited

Clears the function.

Definition at line 92 of file function_base.h.

92{}

◆ clone()

virtual std::unique_ptr< FunctionBase< Real > > libMesh::AutoAreaFunction::clone ( ) const
inlineoverridevirtual
Returns
A new copy of the function.

The new copy should be as "deep" as necessary to allow independent destruction and simultaneous evaluations of the copies in different threads.

Implements libMesh::FunctionBase< Real >.

Definition at line 76 of file triangulator_interface.h.

77 {
78 return std::make_unique<AutoAreaFunction>(_comm, _num_nearest_pts, _power, _background_value, _background_eff_dist);
79 }

References _background_eff_dist, _background_value, _comm, _num_nearest_pts, and _power.

◆ component()

Real libMesh::FunctionBase< Real >::component ( unsigned int  i,
const Point p,
Real  time = 0. 
)
inlinevirtualinherited
Returns
The vector component i at coordinate p and time time.
Note
Subclasses aren't required to override this, since the default implementation is based on the full vector evaluation, which is often correct.
Subclasses are recommended to override this, since the default implementation is based on a vector evaluation, which is usually unnecessarily inefficient.
The default implementation calls operator() with a DenseVector of size i+1 which will result in unexpected behaviour if operator() makes any access beyond that limit.

Definition at line 145 of file function_base.h.

235{
236 DenseVector<Output> outvec(i+1);
237 (*this)(p, time, outvec);
238 return outvec(i);
239}

◆ init()

virtual void libMesh::FunctionBase< Real >::init ( )
inlinevirtualinherited

The actual initialization process.

Definition at line 87 of file function_base.h.

87{}

◆ init_mfi()

void libMesh::AutoAreaFunction::init_mfi ( const std::vector< Point > &  input_pts,
const std::vector< Real > &  input_vals 
)

Definition at line 73 of file triangulator_interface.C.

75{
76 std::vector<std::string> field_vars{"f"};
77 _auto_area_mfi->set_field_variables(field_vars);
78 _auto_area_mfi->get_source_points() = input_pts;
79#ifdef LIBMESH_USE_COMPLEX_NUMBERS
80 std::vector<Number> input_complex_vals;
81 for (const auto & input_val : input_vals)
82 input_complex_vals.push_back(Complex (input_val, 0.0));
83 _auto_area_mfi->get_source_vals() = input_complex_vals;
84#else
85 _auto_area_mfi->get_source_vals() = input_vals;
86#endif
87 _auto_area_mfi->prepare_for_use();
88 this->_initialized = true;
89}
std::complex< Real > Complex

References _auto_area_mfi, and libMesh::FunctionBase< Real >::_initialized.

◆ initialized()

bool libMesh::FunctionBase< Real >::initialized ( ) const
inlineinherited
Returns
true when this object is properly initialized and ready for use, false otherwise.

Definition at line 154 of file function_base.h.

211{
212 return (this->_initialized);
213}

◆ is_time_dependent()

bool libMesh::FunctionBase< Real >::is_time_dependent ( ) const
inlineinherited
Returns
true when the function this object represents is actually time-dependent, false otherwise.

Definition at line 168 of file function_base.h.

225{
226 return (this->_is_time_dependent);
227}

◆ operator()() [1/3]

virtual void libMesh::AutoAreaFunction::operator() ( const Point p,
const Real  time,
DenseVector< Real > &  output 
)
inlineoverridevirtual

Evaluation function for time-dependent vector-valued functions.

Sets output values in the passed-in output DenseVector.

Pure virtual, so you have to override it.

Implements libMesh::FunctionBase< Real >.

Definition at line 67 of file triangulator_interface.h.

70 {
71 output.resize(1);
72 output(0) = (*this)(p,time);
73 return;
74 }

References libMesh::DenseVector< T >::resize().

◆ operator()() [2/3]

Real libMesh::AutoAreaFunction::operator() ( const Point p,
const Real  time 
)
overridevirtual
Returns
The scalar function value at coordinate p and time time, which defaults to zero.

Pure virtual, so you have to override it.

Implements libMesh::FunctionBase< Real >.

Definition at line 91 of file triangulator_interface.C.

93{
95
96 std::vector<Point> target_pts;
97 std::vector<Number> target_vals;
98
99 target_pts.push_back(p);
100 target_vals.resize(1);
101
102 _auto_area_mfi->interpolate_field_data(_auto_area_mfi->field_variables(), target_pts, target_vals);
103
104 return libmesh_real(target_vals.front());
105}
T libmesh_real(T a)
libmesh_assert(ctx)

References _auto_area_mfi, libMesh::FunctionBase< Real >::_initialized, libMesh::libmesh_assert(), and libMesh::libmesh_real().

◆ operator()() [3/3]

void libMesh::FunctionBase< Real >::operator() ( const Point p,
DenseVector< Real > &  output 
)
inlineinherited

Evaluation function for time-independent vector-valued functions.

Sets output values in the passed-in output DenseVector.

Definition at line 116 of file function_base.h.

247{
248 // Call the time-dependent function with t=0.
249 this->operator()(p, 0., output);
250}
virtual Real operator()(const Point &p, const Real time=0.)=0

◆ operator=() [1/2]

AutoAreaFunction & libMesh::AutoAreaFunction::operator= ( AutoAreaFunction &&  )
delete

◆ operator=() [2/2]

AutoAreaFunction & libMesh::AutoAreaFunction::operator= ( const AutoAreaFunction )

◆ set_is_time_dependent()

void libMesh::FunctionBase< Real >::set_is_time_dependent ( bool  is_time_dependent)
inlineinherited

Function to set whether this is a time-dependent function or not.

This is intended to be only used by subclasses who cannot natively determine time-dependence. In such a case, this function should be used immediately following construction.

Definition at line 162 of file function_base.h.

218{
220}

Member Data Documentation

◆ _auto_area_mfi

std::unique_ptr<InverseDistanceInterpolation<3> > libMesh::AutoAreaFunction::_auto_area_mfi
private

Definition at line 87 of file triangulator_interface.h.

Referenced by init_mfi(), and operator()().

◆ _background_eff_dist

const Real libMesh::AutoAreaFunction::_background_eff_dist
private

Definition at line 86 of file triangulator_interface.h.

Referenced by clone().

◆ _background_value

const Real libMesh::AutoAreaFunction::_background_value
private

Definition at line 85 of file triangulator_interface.h.

Referenced by clone().

◆ _comm

const Parallel::Communicator& libMesh::AutoAreaFunction::_comm
private

Definition at line 82 of file triangulator_interface.h.

Referenced by clone().

◆ _initialized

bool libMesh::FunctionBase< Real >::_initialized
protectedinherited

When init() was called so that everything is ready for calls to operator() (...), then this bool is true.

Definition at line 184 of file function_base.h.

◆ _is_time_dependent

bool libMesh::FunctionBase< Real >::_is_time_dependent
protectedinherited

Cache whether or not this function is actually time-dependent.

Definition at line 189 of file function_base.h.

◆ _master

const FunctionBase* libMesh::FunctionBase< Real >::_master
protectedinherited

Const pointer to our master, initialized to nullptr.

There may be cases where multiple functions are required, but to save memory, one master handles some centralized data.

Definition at line 178 of file function_base.h.

◆ _num_nearest_pts

const unsigned int libMesh::AutoAreaFunction::_num_nearest_pts
private

Definition at line 83 of file triangulator_interface.h.

Referenced by clone().

◆ _power

const unsigned int libMesh::AutoAreaFunction::_power
private

Definition at line 84 of file triangulator_interface.h.

Referenced by clone().


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