libMesh
Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Static Protected Attributes | Private Attributes | List of all members
libMesh::TransientRBAssemblyExpansion Class Reference

This extends RBAssemblyExpansion to provide an assembly expansion for the case of time-dependent PDEs. More...

#include <transient_rb_assembly_expansion.h>

Inheritance diagram for libMesh::TransientRBAssemblyExpansion:
[legend]

Public Member Functions

 TransientRBAssemblyExpansion ()=default
 All special functions can be defaulted for this simple class. More...
 
 TransientRBAssemblyExpansion (TransientRBAssemblyExpansion &&)=default
 
 TransientRBAssemblyExpansion (const TransientRBAssemblyExpansion &)=default
 
TransientRBAssemblyExpansionoperator= (const TransientRBAssemblyExpansion &)=default
 
TransientRBAssemblyExpansionoperator= (TransientRBAssemblyExpansion &&)=default
 
virtual ~TransientRBAssemblyExpansion ()=default
 
void perform_M_interior_assembly (unsigned int q, FEMContext &context) const
 Perform the specified M interior assembly. More...
 
void perform_M_boundary_assembly (unsigned int q, FEMContext &context) const
 Perform the specified M boundary assembly. More...
 
unsigned int get_n_M_terms () const
 Get Q_m, the number of terms in the affine expansion for the bilinear form. More...
 
void attach_M_assembly (ElemAssembly *A_q_assembly)
 Attach ElemAssembly object for the time-derivative (both interior and boundary assembly). More...
 
ElemAssemblyget_M_assembly (unsigned int q)
 Return a reference to the specified M_assembly object. More...
 
void perform_A_interior_assembly (unsigned int q, FEMContext &context) const
 Perform the specified A interior assembly. More...
 
void perform_A_boundary_assembly (unsigned int q, FEMContext &context) const
 Perform the specified A boundary assembly. More...
 
void perform_F_interior_assembly (unsigned int q, FEMContext &context) const
 Perform the specified F interior assembly. More...
 
void perform_F_boundary_assembly (unsigned int q, FEMContext &context) const
 Perform the specified F boundary assembly. More...
 
void perform_output_interior_assembly (unsigned int output_index, unsigned int q_l, FEMContext &context) const
 Perform the specified output assembly. More...
 
void perform_output_boundary_assembly (unsigned int output_index, unsigned int q_l, FEMContext &context) const
 Perform the specified output assembly. More...
 
unsigned int get_n_A_terms () const
 Get Q_a, the number of terms in the affine expansion for the bilinear form. More...
 
unsigned int get_n_F_terms () const
 Get Q_f, the number of terms in the affine expansion for the right-hand side. More...
 
unsigned int get_n_outputs () const
 Get n_outputs, the number output functionals. More...
 
unsigned int get_n_output_terms (unsigned int output_index) const
 Get the number of affine terms associated with the specified output. More...
 
void attach_A_assembly (ElemAssembly *Aq_assembly)
 Attach ElemAssembly object for the left-hand side (both interior and boundary assembly). More...
 
void attach_multiple_A_assembly (std::vector< std::unique_ptr< ElemAssembly >> &Aq_assembly)
 Attach multiple ElemAssembly objects for the left-hand side (both interior and boundary assembly). More...
 
void attach_F_assembly (ElemAssembly *Fq_assembly)
 Attach ElemAssembly object for the right-hand side (both interior and boundary assembly). More...
 
void attach_multiple_F_assembly (std::vector< std::unique_ptr< ElemAssembly >> &Fq_assembly)
 Attach multiple ElemAssembly objects for the right-hand side (both interior and boundary assembly). More...
 
virtual void attach_output_assembly (std::vector< std::unique_ptr< ElemAssembly >> &output_assembly)
 Attach ElemAssembly object for an output (both interior and boundary assembly). More...
 
virtual void attach_output_assembly (std::vector< ElemAssembly *> output_assembly)
 Attach ElemAssembly object for an output (both interior and boundary assembly). More...
 
virtual void attach_output_assembly (ElemAssembly *output_assembly)
 Attach ElemAssembly object for an output (both interior and boundary assembly). More...
 
ElemAssemblyget_A_assembly (unsigned int q)
 Return a reference to the specified A_assembly object. More...
 
ElemAssemblyget_F_assembly (unsigned int q)
 Return a reference to the specified F_assembly object. More...
 
ElemAssemblyget_output_assembly (unsigned int output_index, unsigned int q_l)
 Return a reference to the specified output assembly object. More...
 

Static Public Member Functions

static std::string get_info ()
 Gets a string containing the reference information. More...
 
static void print_info (std::ostream &out_stream=libMesh::out)
 Prints the reference information, by default to libMesh::out. More...
 
static unsigned int n_objects ()
 Prints the number of outstanding (created, but not yet destroyed) objects. More...
 
static void enable_print_counter_info ()
 Methods to enable/disable the reference counter output from print_info() More...
 
static void disable_print_counter_info ()
 

Protected Types

typedef std::map< std::string, std::pair< unsigned int, unsigned int > > Counts
 Data structure to log the information. More...
 

Protected Member Functions

void increment_constructor_count (const std::string &name) noexcept
 Increments the construction counter. More...
 
void increment_destructor_count (const std::string &name) noexcept
 Increments the destruction counter. More...
 

Static Protected Attributes

static Counts _counts
 Actually holds the data. More...
 
static Threads::atomic< unsigned int_n_objects
 The number of objects. More...
 
static Threads::spin_mutex _mutex
 Mutual exclusion object to enable thread-safe reference counting. More...
 
static bool _enable_print_counter = true
 Flag to control whether reference count information is printed when print_info is called. More...
 

Private Attributes

std::vector< ElemAssembly * > _M_assembly_vector
 Vectors storing the function pointers to the assembly routines for the time-derivative operators, both interior and boundary assembly. More...
 

Detailed Description

This extends RBAssemblyExpansion to provide an assembly expansion for the case of time-dependent PDEs.

This just requires an extra set of ElemAssembly functors for the time-derivative term.

Author
David J. Knezevic
Date
2011

Definition at line 40 of file transient_rb_assembly_expansion.h.

Member Typedef Documentation

◆ Counts

typedef std::map<std::string, std::pair<unsigned int, unsigned int> > libMesh::ReferenceCounter::Counts
protectedinherited

Data structure to log the information.

The log is identified by the class name.

Definition at line 119 of file reference_counter.h.

Constructor & Destructor Documentation

◆ TransientRBAssemblyExpansion() [1/3]

libMesh::TransientRBAssemblyExpansion::TransientRBAssemblyExpansion ( )
default

All special functions can be defaulted for this simple class.

◆ TransientRBAssemblyExpansion() [2/3]

libMesh::TransientRBAssemblyExpansion::TransientRBAssemblyExpansion ( TransientRBAssemblyExpansion &&  )
default

◆ TransientRBAssemblyExpansion() [3/3]

libMesh::TransientRBAssemblyExpansion::TransientRBAssemblyExpansion ( const TransientRBAssemblyExpansion )
default

◆ ~TransientRBAssemblyExpansion()

virtual libMesh::TransientRBAssemblyExpansion::~TransientRBAssemblyExpansion ( )
virtualdefault

Member Function Documentation

◆ attach_A_assembly()

void RBAssemblyExpansion::attach_A_assembly ( ElemAssembly Aq_assembly)
inherited

Attach ElemAssembly object for the left-hand side (both interior and boundary assembly).

Definition at line 123 of file rb_assembly_expansion.C.

References libMesh::RBAssemblyExpansion::_A_assembly_vector.

Referenced by AcousticsRBAssemblyExpansion::AcousticsRBAssemblyExpansion(), CDRBAssemblyExpansion::CDRBAssemblyExpansion(), EimTestRBAssemblyExpansion::EimTestRBAssemblyExpansion(), ElasticityAssemblyExpansion::ElasticityAssemblyExpansion(), and Ex6AssemblyExpansion::Ex6AssemblyExpansion().

124 {
125  _A_assembly_vector.push_back(Aq_assembly);
126 }
std::vector< ElemAssembly * > _A_assembly_vector
Vectors storing the function pointers to the assembly routines for the affine operators, both interior and boundary assembly.

◆ attach_F_assembly()

void RBAssemblyExpansion::attach_F_assembly ( ElemAssembly Fq_assembly)
inherited

Attach ElemAssembly object for the right-hand side (both interior and boundary assembly).

Definition at line 134 of file rb_assembly_expansion.C.

References libMesh::RBAssemblyExpansion::_F_assembly_vector.

Referenced by AcousticsRBAssemblyExpansion::AcousticsRBAssemblyExpansion(), CDRBAssemblyExpansion::CDRBAssemblyExpansion(), ElasticityAssemblyExpansion::ElasticityAssemblyExpansion(), and Ex6AssemblyExpansion::Ex6AssemblyExpansion().

135 {
136  _F_assembly_vector.push_back(Fq_assembly);
137 }
std::vector< ElemAssembly * > _F_assembly_vector
Vector storing the function pointers to the assembly routines for the rhs affine vectors.

◆ attach_M_assembly()

void libMesh::TransientRBAssemblyExpansion::attach_M_assembly ( ElemAssembly A_q_assembly)

Attach ElemAssembly object for the time-derivative (both interior and boundary assembly).

Definition at line 50 of file transient_rb_assembly_expansion.C.

References _M_assembly_vector.

Referenced by CDRBAssemblyExpansion::CDRBAssemblyExpansion().

51 {
52  _M_assembly_vector.push_back(M_q_assembly);
53 }
std::vector< ElemAssembly * > _M_assembly_vector
Vectors storing the function pointers to the assembly routines for the time-derivative operators...

◆ attach_multiple_A_assembly()

void RBAssemblyExpansion::attach_multiple_A_assembly ( std::vector< std::unique_ptr< ElemAssembly >> &  Aq_assembly)
inherited

Attach multiple ElemAssembly objects for the left-hand side (both interior and boundary assembly).

Definition at line 128 of file rb_assembly_expansion.C.

References libMesh::RBAssemblyExpansion::_A_assembly_vector.

129 {
130  for (auto & up : Aq_assembly)
131  _A_assembly_vector.push_back(up.get());
132 }
std::vector< ElemAssembly * > _A_assembly_vector
Vectors storing the function pointers to the assembly routines for the affine operators, both interior and boundary assembly.

◆ attach_multiple_F_assembly()

void RBAssemblyExpansion::attach_multiple_F_assembly ( std::vector< std::unique_ptr< ElemAssembly >> &  Fq_assembly)
inherited

Attach multiple ElemAssembly objects for the right-hand side (both interior and boundary assembly).

Definition at line 139 of file rb_assembly_expansion.C.

References libMesh::RBAssemblyExpansion::_F_assembly_vector.

140 {
141  for (auto & up : Fq_assembly)
142  _F_assembly_vector.push_back(up.get());
143 }
std::vector< ElemAssembly * > _F_assembly_vector
Vector storing the function pointers to the assembly routines for the rhs affine vectors.

◆ attach_output_assembly() [1/3]

void RBAssemblyExpansion::attach_output_assembly ( std::vector< std::unique_ptr< ElemAssembly >> &  output_assembly)
virtualinherited

Attach ElemAssembly object for an output (both interior and boundary assembly).

In this case we pass in vector arguments to allow for Q_l > 1.

Definition at line 145 of file rb_assembly_expansion.C.

References libMesh::RBAssemblyExpansion::_output_assembly_vector.

Referenced by AcousticsRBAssemblyExpansion::AcousticsRBAssemblyExpansion(), libMesh::RBAssemblyExpansion::attach_output_assembly(), CDRBAssemblyExpansion::CDRBAssemblyExpansion(), and EimTestRBAssemblyExpansion::EimTestRBAssemblyExpansion().

146 {
147  std::vector<ElemAssembly *> output_assembly_ptr;
148  for (auto & up : output_assembly)
149  output_assembly_ptr.push_back(up.get());
150 
151  _output_assembly_vector.push_back(output_assembly_ptr);
152 }
std::vector< std::vector< ElemAssembly * > > _output_assembly_vector
Vector storing the function pointers to the assembly routines for the outputs.

◆ attach_output_assembly() [2/3]

void RBAssemblyExpansion::attach_output_assembly ( std::vector< ElemAssembly *>  output_assembly)
virtualinherited

Attach ElemAssembly object for an output (both interior and boundary assembly).

In this case we pass in vector arguments to allow for Q_l > 1.

Definition at line 154 of file rb_assembly_expansion.C.

References libMesh::RBAssemblyExpansion::_output_assembly_vector.

155 {
156  _output_assembly_vector.push_back(std::move(output_assembly));
157 }
std::vector< std::vector< ElemAssembly * > > _output_assembly_vector
Vector storing the function pointers to the assembly routines for the outputs.

◆ attach_output_assembly() [3/3]

void RBAssemblyExpansion::attach_output_assembly ( ElemAssembly output_assembly)
virtualinherited

Attach ElemAssembly object for an output (both interior and boundary assembly).

This function provides simpler syntax in the case that Q_l = 1; we do not need to use a vector in this case.

Definition at line 159 of file rb_assembly_expansion.C.

References libMesh::RBAssemblyExpansion::attach_output_assembly().

160 {
161  std::vector<ElemAssembly *> L_vector(1); L_vector[0] = output_assembly;
162 
163  attach_output_assembly(L_vector);
164 }
virtual void attach_output_assembly(std::vector< std::unique_ptr< ElemAssembly >> &output_assembly)
Attach ElemAssembly object for an output (both interior and boundary assembly).

◆ disable_print_counter_info()

void libMesh::ReferenceCounter::disable_print_counter_info ( )
staticinherited

Definition at line 100 of file reference_counter.C.

References libMesh::ReferenceCounter::_enable_print_counter.

101 {
102  _enable_print_counter = false;
103  return;
104 }
static bool _enable_print_counter
Flag to control whether reference count information is printed when print_info is called...

◆ enable_print_counter_info()

void libMesh::ReferenceCounter::enable_print_counter_info ( )
staticinherited

Methods to enable/disable the reference counter output from print_info()

Definition at line 94 of file reference_counter.C.

References libMesh::ReferenceCounter::_enable_print_counter.

95 {
96  _enable_print_counter = true;
97  return;
98 }
static bool _enable_print_counter
Flag to control whether reference count information is printed when print_info is called...

◆ get_A_assembly()

ElemAssembly & RBAssemblyExpansion::get_A_assembly ( unsigned int  q)
inherited

Return a reference to the specified A_assembly object.

Definition at line 166 of file rb_assembly_expansion.C.

References libMesh::RBAssemblyExpansion::_A_assembly_vector, and libMesh::RBAssemblyExpansion::get_n_A_terms().

Referenced by libMesh::RBConstruction::add_scaled_Aq(), libMesh::RBConstruction::assemble_Aq_matrix(), and libMesh::RBConstruction::assemble_inner_product_matrix().

167 {
168  libmesh_error_msg_if(q >= get_n_A_terms(),
169  "Error: We must have q < get_n_A_terms in get_A_assembly.");
170 
171  return *_A_assembly_vector[q];
172 }
std::vector< ElemAssembly * > _A_assembly_vector
Vectors storing the function pointers to the assembly routines for the affine operators, both interior and boundary assembly.
unsigned int get_n_A_terms() const
Get Q_a, the number of terms in the affine expansion for the bilinear form.

◆ get_F_assembly()

ElemAssembly & RBAssemblyExpansion::get_F_assembly ( unsigned int  q)
inherited

Return a reference to the specified F_assembly object.

Definition at line 174 of file rb_assembly_expansion.C.

References libMesh::RBAssemblyExpansion::_F_assembly_vector, and libMesh::RBAssemblyExpansion::get_n_F_terms().

Referenced by libMesh::RBConstruction::assemble_Fq_vector().

175 {
176  libmesh_error_msg_if(q >= get_n_F_terms(),
177  "Error: We must have q < get_n_F_terms in get_F_assembly.");
178 
179  return *_F_assembly_vector[q];
180 }
std::vector< ElemAssembly * > _F_assembly_vector
Vector storing the function pointers to the assembly routines for the rhs affine vectors.
unsigned int get_n_F_terms() const
Get Q_f, the number of terms in the affine expansion for the right-hand side.

◆ get_info()

std::string libMesh::ReferenceCounter::get_info ( )
staticinherited

Gets a string containing the reference information.

Definition at line 47 of file reference_counter.C.

References libMesh::ReferenceCounter::_counts, and libMesh::Quality::name().

Referenced by libMesh::ReferenceCounter::print_info().

48 {
49 #if defined(LIBMESH_ENABLE_REFERENCE_COUNTING) && defined(DEBUG)
50 
51  std::ostringstream oss;
52 
53  oss << '\n'
54  << " ---------------------------------------------------------------------------- \n"
55  << "| Reference count information |\n"
56  << " ---------------------------------------------------------------------------- \n";
57 
58  for (const auto & [name, cd] : _counts)
59  oss << "| " << name << " reference count information:\n"
60  << "| Creations: " << cd.first << '\n'
61  << "| Destructions: " << cd.second << '\n';
62 
63  oss << " ---------------------------------------------------------------------------- \n";
64 
65  return oss.str();
66 
67 #else
68 
69  return "";
70 
71 #endif
72 }
std::string name(const ElemQuality q)
This function returns a string containing some name for q.
Definition: elem_quality.C:42
static Counts _counts
Actually holds the data.

◆ get_M_assembly()

ElemAssembly & libMesh::TransientRBAssemblyExpansion::get_M_assembly ( unsigned int  q)

Return a reference to the specified M_assembly object.

Definition at line 55 of file transient_rb_assembly_expansion.C.

References _M_assembly_vector, and get_n_M_terms().

56 {
57  libmesh_error_msg_if(q >= get_n_M_terms(), "Error: We must have q < get_n_M_terms in get_M_assembly.");
58 
59  return *_M_assembly_vector[q];
60 }
std::vector< ElemAssembly * > _M_assembly_vector
Vectors storing the function pointers to the assembly routines for the time-derivative operators...
unsigned int get_n_M_terms() const
Get Q_m, the number of terms in the affine expansion for the bilinear form.

◆ get_n_A_terms()

unsigned int RBAssemblyExpansion::get_n_A_terms ( ) const
inherited

Get Q_a, the number of terms in the affine expansion for the bilinear form.

Definition at line 97 of file rb_assembly_expansion.C.

References libMesh::RBAssemblyExpansion::_A_assembly_vector.

Referenced by libMesh::RBAssemblyExpansion::get_A_assembly(), libMesh::RBAssemblyExpansion::perform_A_boundary_assembly(), and libMesh::RBAssemblyExpansion::perform_A_interior_assembly().

98 {
99  return cast_int<unsigned int>
100  (_A_assembly_vector.size());
101 }
std::vector< ElemAssembly * > _A_assembly_vector
Vectors storing the function pointers to the assembly routines for the affine operators, both interior and boundary assembly.

◆ get_n_F_terms()

unsigned int RBAssemblyExpansion::get_n_F_terms ( ) const
inherited

Get Q_f, the number of terms in the affine expansion for the right-hand side.

Definition at line 103 of file rb_assembly_expansion.C.

References libMesh::RBAssemblyExpansion::_F_assembly_vector.

Referenced by libMesh::RBAssemblyExpansion::get_F_assembly(), libMesh::RBAssemblyExpansion::perform_F_boundary_assembly(), and libMesh::RBAssemblyExpansion::perform_F_interior_assembly().

104 {
105  return cast_int<unsigned int>
106  (_F_assembly_vector.size());
107 }
std::vector< ElemAssembly * > _F_assembly_vector
Vector storing the function pointers to the assembly routines for the rhs affine vectors.

◆ get_n_M_terms()

unsigned int libMesh::TransientRBAssemblyExpansion::get_n_M_terms ( ) const

Get Q_m, the number of terms in the affine expansion for the bilinear form.

Definition at line 45 of file transient_rb_assembly_expansion.C.

References _M_assembly_vector.

Referenced by get_M_assembly(), perform_M_boundary_assembly(), and perform_M_interior_assembly().

46 {
47  return cast_int<unsigned int>(_M_assembly_vector.size());
48 }
std::vector< ElemAssembly * > _M_assembly_vector
Vectors storing the function pointers to the assembly routines for the time-derivative operators...

◆ get_n_output_terms()

unsigned int RBAssemblyExpansion::get_n_output_terms ( unsigned int  output_index) const
inherited

Get the number of affine terms associated with the specified output.

Definition at line 115 of file rb_assembly_expansion.C.

References libMesh::RBAssemblyExpansion::_output_assembly_vector, and libMesh::RBAssemblyExpansion::get_n_outputs().

Referenced by libMesh::RBAssemblyExpansion::get_output_assembly(), libMesh::RBAssemblyExpansion::perform_output_boundary_assembly(), and libMesh::RBAssemblyExpansion::perform_output_interior_assembly().

116 {
117  libmesh_error_msg_if(index >= get_n_outputs(), "Error: We must have index < n_outputs in get_Q_l.");
118 
119  return cast_int<unsigned int>
120  (_output_assembly_vector[index].size());
121 }
unsigned int get_n_outputs() const
Get n_outputs, the number output functionals.
std::vector< std::vector< ElemAssembly * > > _output_assembly_vector
Vector storing the function pointers to the assembly routines for the outputs.

◆ get_n_outputs()

unsigned int RBAssemblyExpansion::get_n_outputs ( ) const
inherited

Get n_outputs, the number output functionals.

Definition at line 109 of file rb_assembly_expansion.C.

References libMesh::RBAssemblyExpansion::_output_assembly_vector.

Referenced by libMesh::RBAssemblyExpansion::get_n_output_terms(), libMesh::RBAssemblyExpansion::get_output_assembly(), libMesh::RBAssemblyExpansion::perform_output_boundary_assembly(), and libMesh::RBAssemblyExpansion::perform_output_interior_assembly().

110 {
111  return cast_int<unsigned int>
112  (_output_assembly_vector.size());
113 }
std::vector< std::vector< ElemAssembly * > > _output_assembly_vector
Vector storing the function pointers to the assembly routines for the outputs.

◆ get_output_assembly()

ElemAssembly & RBAssemblyExpansion::get_output_assembly ( unsigned int  output_index,
unsigned int  q_l 
)
inherited

Return a reference to the specified output assembly object.

Definition at line 182 of file rb_assembly_expansion.C.

References libMesh::RBAssemblyExpansion::_output_assembly_vector, libMesh::RBAssemblyExpansion::get_n_output_terms(), and libMesh::RBAssemblyExpansion::get_n_outputs().

Referenced by libMesh::RBConstruction::assemble_all_output_vectors().

184 {
185  libmesh_error_msg_if((output_index >= get_n_outputs()) || (q_l >= get_n_output_terms(output_index)),
186  "Error: We must have output_index < n_outputs and "
187  "q_l < get_n_output_terms(output_index) in get_output_assembly.");
188 
189  return *_output_assembly_vector[output_index][q_l];
190 }
unsigned int get_n_outputs() const
Get n_outputs, the number output functionals.
unsigned int get_n_output_terms(unsigned int output_index) const
Get the number of affine terms associated with the specified output.
std::vector< std::vector< ElemAssembly * > > _output_assembly_vector
Vector storing the function pointers to the assembly routines for the outputs.

◆ increment_constructor_count()

void libMesh::ReferenceCounter::increment_constructor_count ( const std::string &  name)
inlineprotectednoexceptinherited

Increments the construction counter.

Should be called in the constructor of any derived class that will be reference counted.

Definition at line 183 of file reference_counter.h.

References libMesh::err, libMesh::BasicOStreamProxy< charT, traits >::get(), libMesh::Quality::name(), and libMesh::Threads::spin_mtx.

Referenced by libMesh::ReferenceCountedObject< RBParametrized >::ReferenceCountedObject().

184 {
185  libmesh_try
186  {
187  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
188  std::pair<unsigned int, unsigned int> & p = _counts[name];
189  p.first++;
190  }
191  libmesh_catch (...)
192  {
193  auto stream = libMesh::err.get();
194  stream->exceptions(stream->goodbit); // stream must not throw
195  libMesh::err << "Encountered unrecoverable error while calling "
196  << "ReferenceCounter::increment_constructor_count() "
197  << "for a(n) " << name << " object." << std::endl;
198  std::terminate();
199  }
200 }
std::string name(const ElemQuality q)
This function returns a string containing some name for q.
Definition: elem_quality.C:42
OStreamProxy err
static Counts _counts
Actually holds the data.
streamT * get()
Rather than implement every ostream/ios/ios_base function, we&#39;ll be lazy and make esoteric uses go th...
spin_mutex spin_mtx
A convenient spin mutex object which can be used for obtaining locks.
Definition: threads.C:30

◆ increment_destructor_count()

void libMesh::ReferenceCounter::increment_destructor_count ( const std::string &  name)
inlineprotectednoexceptinherited

Increments the destruction counter.

Should be called in the destructor of any derived class that will be reference counted.

Definition at line 207 of file reference_counter.h.

References libMesh::err, libMesh::BasicOStreamProxy< charT, traits >::get(), libMesh::Quality::name(), and libMesh::Threads::spin_mtx.

Referenced by libMesh::ReferenceCountedObject< RBParametrized >::~ReferenceCountedObject().

208 {
209  libmesh_try
210  {
211  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
212  std::pair<unsigned int, unsigned int> & p = _counts[name];
213  p.second++;
214  }
215  libmesh_catch (...)
216  {
217  auto stream = libMesh::err.get();
218  stream->exceptions(stream->goodbit); // stream must not throw
219  libMesh::err << "Encountered unrecoverable error while calling "
220  << "ReferenceCounter::increment_destructor_count() "
221  << "for a(n) " << name << " object." << std::endl;
222  std::terminate();
223  }
224 }
std::string name(const ElemQuality q)
This function returns a string containing some name for q.
Definition: elem_quality.C:42
OStreamProxy err
static Counts _counts
Actually holds the data.
streamT * get()
Rather than implement every ostream/ios/ios_base function, we&#39;ll be lazy and make esoteric uses go th...
spin_mutex spin_mtx
A convenient spin mutex object which can be used for obtaining locks.
Definition: threads.C:30

◆ n_objects()

static unsigned int libMesh::ReferenceCounter::n_objects ( )
inlinestaticinherited

Prints the number of outstanding (created, but not yet destroyed) objects.

Definition at line 85 of file reference_counter.h.

References libMesh::ReferenceCounter::_n_objects.

Referenced by libMesh::LibMeshInit::~LibMeshInit().

86  { return _n_objects; }
static Threads::atomic< unsigned int > _n_objects
The number of objects.

◆ operator=() [1/2]

TransientRBAssemblyExpansion& libMesh::TransientRBAssemblyExpansion::operator= ( const TransientRBAssemblyExpansion )
default

◆ operator=() [2/2]

TransientRBAssemblyExpansion& libMesh::TransientRBAssemblyExpansion::operator= ( TransientRBAssemblyExpansion &&  )
default

◆ perform_A_boundary_assembly()

void RBAssemblyExpansion::perform_A_boundary_assembly ( unsigned int  q,
FEMContext context 
) const
inherited

Perform the specified A boundary assembly.

Definition at line 38 of file rb_assembly_expansion.C.

References libMesh::RBAssemblyExpansion::_A_assembly_vector, libMesh::RBAssemblyExpansion::get_n_A_terms(), and libMesh::libmesh_assert().

40 {
41  libmesh_error_msg_if(q >= get_n_A_terms(),
42  "Error: We must have q < get_n_A_terms in perform_A_boundary_assembly.");
43 
45 
46  return _A_assembly_vector[q]->boundary_assembly( context );
47 }
libmesh_assert(ctx)
std::vector< ElemAssembly * > _A_assembly_vector
Vectors storing the function pointers to the assembly routines for the affine operators, both interior and boundary assembly.
unsigned int get_n_A_terms() const
Get Q_a, the number of terms in the affine expansion for the bilinear form.

◆ perform_A_interior_assembly()

void RBAssemblyExpansion::perform_A_interior_assembly ( unsigned int  q,
FEMContext context 
) const
inherited

Perform the specified A interior assembly.

Definition at line 27 of file rb_assembly_expansion.C.

References libMesh::RBAssemblyExpansion::_A_assembly_vector, libMesh::RBAssemblyExpansion::get_n_A_terms(), and libMesh::libmesh_assert().

29 {
30  libmesh_error_msg_if(q >= get_n_A_terms(),
31  "Error: We must have q < get_n_A_terms in perform_A_interior_assembly.");
32 
34 
35  return _A_assembly_vector[q]->interior_assembly( context );
36 }
libmesh_assert(ctx)
std::vector< ElemAssembly * > _A_assembly_vector
Vectors storing the function pointers to the assembly routines for the affine operators, both interior and boundary assembly.
unsigned int get_n_A_terms() const
Get Q_a, the number of terms in the affine expansion for the bilinear form.

◆ perform_F_boundary_assembly()

void RBAssemblyExpansion::perform_F_boundary_assembly ( unsigned int  q,
FEMContext context 
) const
inherited

Perform the specified F boundary assembly.

Definition at line 60 of file rb_assembly_expansion.C.

References libMesh::RBAssemblyExpansion::_A_assembly_vector, libMesh::RBAssemblyExpansion::_F_assembly_vector, libMesh::RBAssemblyExpansion::get_n_F_terms(), and libMesh::libmesh_assert().

62 {
63  libmesh_error_msg_if(q >= get_n_F_terms(),
64  "Error: We must have q < get_n_F_terms in perform_F_interior_assembly.");
65 
67 
68  return _F_assembly_vector[q]->boundary_assembly( context );
69 }
std::vector< ElemAssembly * > _F_assembly_vector
Vector storing the function pointers to the assembly routines for the rhs affine vectors.
libmesh_assert(ctx)
std::vector< ElemAssembly * > _A_assembly_vector
Vectors storing the function pointers to the assembly routines for the affine operators, both interior and boundary assembly.
unsigned int get_n_F_terms() const
Get Q_f, the number of terms in the affine expansion for the right-hand side.

◆ perform_F_interior_assembly()

void RBAssemblyExpansion::perform_F_interior_assembly ( unsigned int  q,
FEMContext context 
) const
inherited

Perform the specified F interior assembly.

Definition at line 49 of file rb_assembly_expansion.C.

References libMesh::RBAssemblyExpansion::_A_assembly_vector, libMesh::RBAssemblyExpansion::_F_assembly_vector, libMesh::RBAssemblyExpansion::get_n_F_terms(), and libMesh::libmesh_assert().

51 {
52  libmesh_error_msg_if(q >= get_n_F_terms(),
53  "Error: We must have q < get_n_F_terms in perform_F_interior_assembly.");
54 
56 
57  return _F_assembly_vector[q]->interior_assembly( context );
58 }
std::vector< ElemAssembly * > _F_assembly_vector
Vector storing the function pointers to the assembly routines for the rhs affine vectors.
libmesh_assert(ctx)
std::vector< ElemAssembly * > _A_assembly_vector
Vectors storing the function pointers to the assembly routines for the affine operators, both interior and boundary assembly.
unsigned int get_n_F_terms() const
Get Q_f, the number of terms in the affine expansion for the right-hand side.

◆ perform_M_boundary_assembly()

void libMesh::TransientRBAssemblyExpansion::perform_M_boundary_assembly ( unsigned int  q,
FEMContext context 
) const

Perform the specified M boundary assembly.

Definition at line 36 of file transient_rb_assembly_expansion.C.

References _M_assembly_vector, get_n_M_terms(), and libMesh::libmesh_assert().

38 {
39  libmesh_error_msg_if(q >= get_n_M_terms(), "Error: We must have q < get_n_M_terms in perform_M_boundary_assembly.");
41 
42  return _M_assembly_vector[q]->boundary_assembly( context );
43 }
std::vector< ElemAssembly * > _M_assembly_vector
Vectors storing the function pointers to the assembly routines for the time-derivative operators...
libmesh_assert(ctx)
unsigned int get_n_M_terms() const
Get Q_m, the number of terms in the affine expansion for the bilinear form.

◆ perform_M_interior_assembly()

void libMesh::TransientRBAssemblyExpansion::perform_M_interior_assembly ( unsigned int  q,
FEMContext context 
) const

Perform the specified M interior assembly.

Definition at line 27 of file transient_rb_assembly_expansion.C.

References _M_assembly_vector, get_n_M_terms(), and libMesh::libmesh_assert().

29 {
30  libmesh_error_msg_if(q >= get_n_M_terms(), "Error: We must have q < get_n_M_terms in perform_M_interior_assembly.");
32 
33  return _M_assembly_vector[q]->interior_assembly( context );
34 }
std::vector< ElemAssembly * > _M_assembly_vector
Vectors storing the function pointers to the assembly routines for the time-derivative operators...
libmesh_assert(ctx)
unsigned int get_n_M_terms() const
Get Q_m, the number of terms in the affine expansion for the bilinear form.

◆ perform_output_boundary_assembly()

void RBAssemblyExpansion::perform_output_boundary_assembly ( unsigned int  output_index,
unsigned int  q_l,
FEMContext context 
) const
inherited

Perform the specified output assembly.

Definition at line 84 of file rb_assembly_expansion.C.

References libMesh::RBAssemblyExpansion::_output_assembly_vector, libMesh::RBAssemblyExpansion::get_n_output_terms(), libMesh::RBAssemblyExpansion::get_n_outputs(), and libMesh::libmesh_assert().

87 {
88  libmesh_error_msg_if((output_index >= get_n_outputs()) || (q_l >= get_n_output_terms(output_index)),
89  "Error: We must have output_index < n_outputs and "
90  "q_l < get_n_output_terms(output_index) in perform_output_boundary_assembly.");
91 
92  libmesh_assert(_output_assembly_vector[output_index][q_l]);
93 
94  return _output_assembly_vector[output_index][q_l]->boundary_assembly(context);
95 }
unsigned int get_n_outputs() const
Get n_outputs, the number output functionals.
unsigned int get_n_output_terms(unsigned int output_index) const
Get the number of affine terms associated with the specified output.
std::vector< std::vector< ElemAssembly * > > _output_assembly_vector
Vector storing the function pointers to the assembly routines for the outputs.
libmesh_assert(ctx)

◆ perform_output_interior_assembly()

void RBAssemblyExpansion::perform_output_interior_assembly ( unsigned int  output_index,
unsigned int  q_l,
FEMContext context 
) const
inherited

Perform the specified output assembly.

Definition at line 71 of file rb_assembly_expansion.C.

References libMesh::RBAssemblyExpansion::_output_assembly_vector, libMesh::RBAssemblyExpansion::get_n_output_terms(), libMesh::RBAssemblyExpansion::get_n_outputs(), and libMesh::libmesh_assert().

74 {
75  libmesh_error_msg_if((output_index >= get_n_outputs()) || (q_l >= get_n_output_terms(output_index)),
76  "Error: We must have output_index < n_outputs and "
77  "q_l < get_n_output_terms(output_index) in perform_output_interior_assembly.");
78 
79  libmesh_assert(_output_assembly_vector[output_index][q_l]);
80 
81  return _output_assembly_vector[output_index][q_l]->interior_assembly(context);
82 }
unsigned int get_n_outputs() const
Get n_outputs, the number output functionals.
unsigned int get_n_output_terms(unsigned int output_index) const
Get the number of affine terms associated with the specified output.
std::vector< std::vector< ElemAssembly * > > _output_assembly_vector
Vector storing the function pointers to the assembly routines for the outputs.
libmesh_assert(ctx)

◆ print_info()

void libMesh::ReferenceCounter::print_info ( std::ostream &  out_stream = libMesh::out)
staticinherited

Prints the reference information, by default to libMesh::out.

Definition at line 81 of file reference_counter.C.

References libMesh::ReferenceCounter::_enable_print_counter, and libMesh::ReferenceCounter::get_info().

Referenced by libMesh::LibMeshInit::~LibMeshInit().

82 {
84  out_stream << ReferenceCounter::get_info();
85 }
static std::string get_info()
Gets a string containing the reference information.
static bool _enable_print_counter
Flag to control whether reference count information is printed when print_info is called...

Member Data Documentation

◆ _counts

ReferenceCounter::Counts libMesh::ReferenceCounter::_counts
staticprotectedinherited

Actually holds the data.

Definition at line 124 of file reference_counter.h.

Referenced by libMesh::ReferenceCounter::get_info().

◆ _enable_print_counter

bool libMesh::ReferenceCounter::_enable_print_counter = true
staticprotectedinherited

Flag to control whether reference count information is printed when print_info is called.

Definition at line 143 of file reference_counter.h.

Referenced by libMesh::ReferenceCounter::disable_print_counter_info(), libMesh::ReferenceCounter::enable_print_counter_info(), and libMesh::ReferenceCounter::print_info().

◆ _M_assembly_vector

std::vector<ElemAssembly *> libMesh::TransientRBAssemblyExpansion::_M_assembly_vector
private

Vectors storing the function pointers to the assembly routines for the time-derivative operators, both interior and boundary assembly.

Definition at line 90 of file transient_rb_assembly_expansion.h.

Referenced by attach_M_assembly(), get_M_assembly(), get_n_M_terms(), perform_M_boundary_assembly(), and perform_M_interior_assembly().

◆ _mutex

Threads::spin_mutex libMesh::ReferenceCounter::_mutex
staticprotectedinherited

Mutual exclusion object to enable thread-safe reference counting.

Definition at line 137 of file reference_counter.h.

◆ _n_objects

Threads::atomic< unsigned int > libMesh::ReferenceCounter::_n_objects
staticprotectedinherited

The number of objects.

Print the reference count information when the number returns to 0.

Definition at line 132 of file reference_counter.h.

Referenced by libMesh::ReferenceCounter::n_objects(), libMesh::ReferenceCounter::ReferenceCounter(), and libMesh::ReferenceCounter::~ReferenceCounter().


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