queso-0.57.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
QUESO::LibMeshFunction Class Reference

Function objects using libMesh for the backend. More...

#include <LibMeshFunction.h>

Inheritance diagram for QUESO::LibMeshFunction:
QUESO::FunctionBase

Public Member Functions

void print_info () const
 Will print mesh-related libMesh foo to std::cerr. More...
 
virtual void save_function (const std::string &filename, double time) const
 Save the current function to an Exodus file called filename. time is the time to attach to the function and is usually the iteration number. More...
 
virtual void add (double scale, const FunctionBase &rhs)
 Execute this += scale * rhs. More...
 
virtual void pointwise_mult (const FunctionBase &f1, const FunctionBase &f2)
 Pointwise multiply f1 and f2 and store the result in *this. More...
 
virtual void scale (double scale)
 Execute this *= scale. More...
 
virtual void zero ()
 Set this to zero everywhere. More...
 
virtual double L2_norm () const
 Return the L2-norm of this. More...
 
virtual SharedPtr
< FunctionBase >::Type 
zero_clone () const
 Create a zero function copy of this and return pointer to it. More...
 
virtual SharedPtr
< libMesh::EquationSystems >
::Type 
get_equation_systems () const
 Return the internal libmesh equation systems object. More...
 
Constructor/Destructor methods
 LibMeshFunction (const FunctionOperatorBuilder &builder, libMesh::MeshBase &m)
 Construct a function with a user-provided mesh m and builder. More...
 
 ~LibMeshFunction ()
 Destructor. More...
 
- Public Member Functions inherited from QUESO::FunctionBase
 FunctionBase ()
 Constructor. More...
 
virtual ~FunctionBase ()
 Destructor. More...
 

Private Attributes

const FunctionOperatorBuilderbuilder
 
SharedPtr
< libMesh::EquationSystems >
::Type 
equation_systems
 

Detailed Description

Function objects using libMesh for the backend.

Definition at line 53 of file LibMeshFunction.h.

Constructor & Destructor Documentation

QUESO::LibMeshFunction::LibMeshFunction ( const FunctionOperatorBuilder builder,
libMesh::MeshBase &  m 
)

Construct a function with a user-provided mesh m and builder.

It is expected the lifetime of m will outlive this

A builder object is just one that a FEM library backend can use to set up various options. Polynomial type, polynomial order, and the number of eigenpairs to request are good examples.

Definition at line 64 of file LibMeshFunction.C.

References equation_systems, and QUESO::FunctionOperatorBuilder::order.

Referenced by zero_clone().

66  : FunctionBase(),
68  equation_systems(new libMesh::EquationSystems(m))
69 {
70  this->equation_systems->add_system<libMesh::ExplicitSystem>("Function");
71  this->equation_systems->get_system("Function").add_variable("u",
72  libMesh::Utility::string_to_enum<libMeshEnums::Order>(this->builder.order),
73  libMesh::Utility::string_to_enum<libMeshEnums::FEFamily>(this->builder.family));
74  this->equation_systems->init();
75 }
std::string order
String to store the polynomial order to use. Default is &quot;FIRST&quot;.
SharedPtr< libMesh::EquationSystems >::Type equation_systems
const FunctionOperatorBuilder & builder
FunctionBase()
Constructor.
Definition: FunctionBase.C:30
QUESO::LibMeshFunction::~LibMeshFunction ( )

Destructor.

Definition at line 77 of file LibMeshFunction.C.

78 {
79 }

Member Function Documentation

void QUESO::LibMeshFunction::add ( double  scale,
const FunctionBase rhs 
)
virtual

Execute this += scale * rhs.

Implements QUESO::FunctionBase.

Definition at line 96 of file LibMeshFunction.C.

References equation_systems.

96  {
97  // We know we're dealing with a derived class type, so cast
98  const LibMeshFunction & rhs_derived = dynamic_cast<
99  const LibMeshFunction &>(rhs);
100 
101  this->equation_systems->get_system<libMesh::ExplicitSystem>("Function").solution->add(
102  scale, *(rhs_derived.equation_systems->get_system<libMesh::ExplicitSystem>(
103  "Function").solution));
104 }
SharedPtr< libMesh::EquationSystems >::Type equation_systems
virtual void scale(double scale)
Execute this *= scale.
LibMeshFunction(const FunctionOperatorBuilder &builder, libMesh::MeshBase &m)
Construct a function with a user-provided mesh m and builder.
SharedPtr< libMesh::EquationSystems >::Type QUESO::LibMeshFunction::get_equation_systems ( ) const
virtual

Return the internal libmesh equation systems object.

Definition at line 150 of file LibMeshFunction.C.

References equation_systems.

Referenced by QUESO::LibMeshOperatorBase::inverse_kl_transform().

150  {
151  return this->equation_systems;
152 }
SharedPtr< libMesh::EquationSystems >::Type equation_systems
double QUESO::LibMeshFunction::L2_norm ( ) const
virtual

Return the L2-norm of this.

Implements QUESO::FunctionBase.

Definition at line 129 of file LibMeshFunction.C.

References equation_systems.

129  {
130  libMesh::ExplicitSystem & system =
131  this->equation_systems->get_system<libMesh::ExplicitSystem>("Function");
132 
133  double norm = system.calculate_norm(*system.solution,
134  libMesh::SystemNorm(libMeshEnums::L2));
135  return norm;
136 }
SharedPtr< libMesh::EquationSystems >::Type equation_systems
void QUESO::LibMeshFunction::pointwise_mult ( const FunctionBase f1,
const FunctionBase f2 
)
virtual

Pointwise multiply f1 and f2 and store the result in *this.

Implements QUESO::FunctionBase.

Definition at line 106 of file LibMeshFunction.C.

References equation_systems.

108 {
109  const LibMeshFunction & f1_derived = static_cast<
110  const LibMeshFunction &>(f1);
111  const LibMeshFunction & f2_derived = static_cast<
112  const LibMeshFunction &>(f2);
113 
114  this->equation_systems->get_system<libMesh::ExplicitSystem>("Function").solution->pointwise_mult(
115  *(f1_derived.equation_systems->get_system<libMesh::ExplicitSystem>("Function").solution),
116  *(f2_derived.equation_systems->get_system<libMesh::ExplicitSystem>("Function").solution));
117 }
SharedPtr< libMesh::EquationSystems >::Type equation_systems
LibMeshFunction(const FunctionOperatorBuilder &builder, libMesh::MeshBase &m)
Construct a function with a user-provided mesh m and builder.
void QUESO::LibMeshFunction::print_info ( ) const

Will print mesh-related libMesh foo to std::cerr.

Definition at line 81 of file LibMeshFunction.C.

References equation_systems.

82 {
83  // Print information about the mesh to the screen.
84  this->equation_systems->get_mesh().print_info(std::cerr);
85 }
SharedPtr< libMesh::EquationSystems >::Type equation_systems
void QUESO::LibMeshFunction::save_function ( const std::string &  filename,
double  time 
) const
virtual

Save the current function to an Exodus file called filename. time is the time to attach to the function and is usually the iteration number.

Implements QUESO::FunctionBase.

Definition at line 87 of file LibMeshFunction.C.

References equation_systems.

88 {
89  // The "1" is hardcoded for the number of time steps because the ExodusII
90  // manual states that it should be the number of timesteps within the file.
91  // Here, we are explicitly only doing one timestep per file.
92  libMesh::ExodusII_IO(this->equation_systems->get_mesh()).write_timestep(
93  filename, *this->equation_systems, 1, time);
94 }
SharedPtr< libMesh::EquationSystems >::Type equation_systems
void QUESO::LibMeshFunction::scale ( double  scale)
virtual

Execute this *= scale.

Implements QUESO::FunctionBase.

Definition at line 119 of file LibMeshFunction.C.

References equation_systems.

119  {
120  this->equation_systems->get_system<libMesh::ExplicitSystem>(
121  "Function").solution->scale(scale);
122 }
SharedPtr< libMesh::EquationSystems >::Type equation_systems
virtual void scale(double scale)
Execute this *= scale.
void QUESO::LibMeshFunction::zero ( )
virtual

Set this to zero everywhere.

Implements QUESO::FunctionBase.

Definition at line 124 of file LibMeshFunction.C.

References equation_systems.

124  {
125  this->equation_systems->get_system<libMesh::ExplicitSystem>(
126  "Function").solution->zero();
127 }
SharedPtr< libMesh::EquationSystems >::Type equation_systems
SharedPtr< FunctionBase >::Type QUESO::LibMeshFunction::zero_clone ( ) const
virtual

Create a zero function copy of this and return pointer to it.

Create a new instance of FunctionBase representing the function that is identically zero (by copying this) everywhere and return a boost shared pointer to it

Implements QUESO::FunctionBase.

Definition at line 138 of file LibMeshFunction.C.

References builder, equation_systems, and LibMeshFunction().

139 {
140  LibMeshFunction * clone = new LibMeshFunction(this->builder,
141  this->equation_systems->get_mesh());
142  clone->equation_systems->get_system<libMesh::ExplicitSystem>(
143  "Function").solution->zero();
144 
146  return ptr;
147 }
SharedPtr< libMesh::EquationSystems >::Type equation_systems
const FunctionOperatorBuilder & builder
Definition of a shared pointer.
LibMeshFunction(const FunctionOperatorBuilder &builder, libMesh::MeshBase &m)
Construct a function with a user-provided mesh m and builder.

Member Data Documentation

const FunctionOperatorBuilder& QUESO::LibMeshFunction::builder
private

Definition at line 107 of file LibMeshFunction.h.

Referenced by zero_clone().

SharedPtr<libMesh::EquationSystems>::Type QUESO::LibMeshFunction::equation_systems
private

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

Generated on Tue Jun 5 2018 19:49:09 for queso-0.57.1 by  doxygen 1.8.5