libMesh::TransientSystem< Base > Class Template Reference

#include <transient_system.h>

Inheritance diagram for libMesh::TransientSystem< Base >:

Public Types

typedef TransientSystem< Base > sys_type
 

Public Member Functions

 TransientSystem (EquationSystems &es, const std::string &name, const unsigned int number)
 
virtual ~TransientSystem ()
 
sys_typesystem ()
 
virtual void clear ()
 
virtual void reinit ()
 
virtual std::string system_type () const
 
Number old_solution (const dof_id_type global_dof_number) const
 
Number older_solution (const dof_id_type global_dof_number) const
 

Public Attributes

AutoPtr< NumericVector< Number > > old_local_solution
 
AutoPtr< NumericVector< Number > > older_local_solution
 

Protected Member Functions

virtual void init_data ()
 
virtual void re_update ()
 

Detailed Description

template<class Base>
class libMesh::TransientSystem< Base >

This class provides a specific system class. It aims at transient systems, offering nothing more than just the essentials needed to solve a system. Note that still additional vectors/matrices may be added, as offered in the parent classes.

Definition at line 48 of file transient_system.h.

Member Typedef Documentation

template<class Base>
typedef TransientSystem<Base> libMesh::TransientSystem< Base >::sys_type

The type of system.

Definition at line 68 of file transient_system.h.

Constructor & Destructor Documentation

template<class Base >
libMesh::TransientSystem< Base >::TransientSystem ( EquationSystems es,
const std::string &  name,
const unsigned int  number 
)

Constructor. Initializes required data structures.

Definition at line 38 of file transient_system.C.

References libMeshEnums::GHOSTED, libMesh::TransientSystem< Base >::old_local_solution, libMesh::TransientSystem< Base >::older_local_solution, and libMeshEnums::SERIAL.

40  :
41 
42  Base (es, name_in, number_in)
43 {
44 #ifdef LIBMESH_ENABLE_GHOSTED
46  AutoPtr<NumericVector<Number> >
47  (&(this->add_vector("_transient_old_local_solution", true, GHOSTED)));
49  AutoPtr<NumericVector<Number> >
50  (&(this->add_vector("_transient_older_local_solution", true, GHOSTED)));
51 #else
53  AutoPtr<NumericVector<Number> >
54  (&(this->add_vector("_transient_old_local_solution", true, SERIAL)));
56  AutoPtr<NumericVector<Number> >
57  (&(this->add_vector("_transient_older_local_solution", true, SERIAL)));
58 #endif
59 }
template<class Base >
libMesh::TransientSystem< Base >::~TransientSystem ( )
virtual

Destructor.

Definition at line 64 of file transient_system.C.

65 {
66  this->clear();
67 
68  // We still have AutoPtrs for API compatibility, but
69  // now that we're System::add_vector()ing these, we can trust
70  // the base class to handle memory management
71  old_local_solution.release();
72  older_local_solution.release();
73 }

Member Function Documentation

template<class Base >
void libMesh::TransientSystem< Base >::clear ( )
virtual

Clear all the data structures associated with the system.

Reimplemented in libMesh::TransientRBConstruction.

Definition at line 78 of file transient_system.C.

79 {
80  // clear the parent data
81  Base::clear();
82 
83  // the old & older local solutions
84  // are now deleted by System!
85  // old_local_solution->clear();
86  // older_local_solution->clear();
87 
88  // FIXME: This preserves maximum backwards compatibility,
89  // but is probably grossly unnecessary:
90  old_local_solution.release();
91  older_local_solution.release();
92 
94  AutoPtr<NumericVector<Number> >
95  (&(this->add_vector("_transient_old_local_solution")));
97  AutoPtr<NumericVector<Number> >
98  (&(this->add_vector("_transient_older_local_solution")));
99 }
template<class Base >
void libMesh::TransientSystem< Base >::init_data ( )
protectedvirtual

Initializes the member data fields associated with the system, so that, e.g., assemble() may be used.

Definition at line 105 of file transient_system.C.

References libMeshEnums::GHOSTED, and libMeshEnums::SERIAL.

106 {
107  // initialize parent data
108  Base::init_data();
109 
110  // Initialize the old & older solutions
111  // Using new ghosted vectors if enabled
112 #ifdef LIBMESH_ENABLE_GHOSTED
113  old_local_solution->init (this->n_dofs(), this->n_local_dofs(),
114  this->get_dof_map().get_send_list(), false,
115  GHOSTED);
116  older_local_solution->init (this->n_dofs(), this->n_local_dofs(),
117  this->get_dof_map().get_send_list(), false,
118  GHOSTED);
119 #else
120  old_local_solution->init (this->n_dofs(), false, SERIAL);
121  older_local_solution->init (this->n_dofs(), false, SERIAL);
122 #endif
123 }
template<class Base >
Number libMesh::TransientSystem< Base >::old_solution ( const dof_id_type  global_dof_number) const
Returns
the old solution (at the previous timestep) for the specified global DOF.

Definition at line 177 of file transient_system.C.

178 {
179  // Check the sizes
180  libmesh_assert_less (global_dof_number, this->get_dof_map().n_dofs());
181  libmesh_assert_less (global_dof_number, old_local_solution->size());
182 
183  return (*old_local_solution)(global_dof_number);
184 }
template<class Base >
Number libMesh::TransientSystem< Base >::older_solution ( const dof_id_type  global_dof_number) const
Returns
the older solution (two timesteps ago) for the specified global DOF.

Definition at line 189 of file transient_system.C.

190 {
191  // Check the sizes
192  libmesh_assert_less (global_dof_number, this->get_dof_map().n_dofs());
193  libmesh_assert_less (global_dof_number, older_local_solution->size());
194 
195  return (*older_local_solution)(global_dof_number);
196 }
template<class Base >
void libMesh::TransientSystem< Base >::re_update ( )
protectedvirtual

Re-update the local values when the mesh has changed. This method takes the data updated by update() and makes it up-to-date on the current mesh.

Definition at line 142 of file transient_system.C.

143 {
144  // re_update the parent system
145  Base::re_update ();
146 
147  const std::vector<dof_id_type>& send_list = this->get_dof_map().get_send_list ();
148 
149  const dof_id_type first_local_dof = Base::get_dof_map().first_dof();
150  const dof_id_type end_local_dof = Base::get_dof_map().end_dof();
151 
152  // Check sizes
153  libmesh_assert_greater_equal (end_local_dof, first_local_dof);
154  libmesh_assert_greater_equal (older_local_solution->size(), send_list.size());
155  libmesh_assert_greater_equal (old_local_solution->size(), send_list.size());
156 
157  // Even if we don't have to do anything ourselves, localize() may
158  // use parallel_only tools
159  // if (first_local_dof == end_local_dof)
160  // return;
161 
162  // Update the old & older solutions with the send_list,
163  // which may have changed since their last update.
164  older_local_solution->localize (first_local_dof,
165  end_local_dof-1,
166  send_list);
167 
168  old_local_solution->localize (first_local_dof,
169  end_local_dof-1,
170  send_list);
171 }
template<class Base >
void libMesh::TransientSystem< Base >::reinit ( )
virtual

Reinitializes the member data fields associated with the system, so that, e.g., assemble() may be used.

Definition at line 128 of file transient_system.C.

129 {
130  // initialize parent data
131  Base::reinit();
132 
133  // Project the old & older vectors to the new mesh
134  // The System::reinit handles this now
135  // this->project_vector (*old_local_solution);
136  // this->project_vector (*older_local_solution);
137 }
template<class Base>
sys_type& libMesh::TransientSystem< Base >::system ( )
inline
Returns
a clever pointer to the system.

Definition at line 73 of file transient_system.h.

73 { return *this; }
template<class Base >
std::string libMesh::TransientSystem< Base >::system_type ( ) const
inlinevirtual
Returns
"Transient" prepended to T::system_type(). Helps in identifying the system type in an equation system file.

Definition at line 160 of file transient_system.h.

161 {
162  std::string type = "Transient";
163  type += Base::system_type ();
164 
165  return type;
166 }

Member Data Documentation

template<class Base>
AutoPtr<NumericVector<Number> > libMesh::TransientSystem< Base >::old_local_solution

All the values I need to compute my contribution to the simulation at hand. Think of this as the current solution with any ghost values needed from other processors.

Definition at line 116 of file transient_system.h.

Referenced by libMesh::TransientSystem< Base >::TransientSystem().

template<class Base>
AutoPtr<NumericVector<Number> > libMesh::TransientSystem< Base >::older_local_solution

All the values I need to compute my contribution to the simulation at hand. Think of this as the current solution with any ghost values needed from other processors.

Definition at line 124 of file transient_system.h.

Referenced by libMesh::TransientSystem< Base >::TransientSystem().


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

Site Created By: libMesh Developers
Last modified: February 07 2014 16:58:02 UTC

Hosted By:
SourceForge.net Logo