libMesh::TransientSystem< Base > Class Template Reference

#include <transient_system.h>

List of all members.

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.

Reimplemented in libMesh::TransientRBConstruction.

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 
) [inline]

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.

00040                                                                       :
00041 
00042   Base                 (es, name_in, number_in)
00043 {
00044 #ifdef LIBMESH_ENABLE_GHOSTED
00045   old_local_solution =
00046     AutoPtr<NumericVector<Number> >
00047       (&(this->add_vector("_transient_old_local_solution", true, GHOSTED)));
00048   older_local_solution =
00049     AutoPtr<NumericVector<Number> >
00050       (&(this->add_vector("_transient_older_local_solution", true, GHOSTED)));
00051 #else
00052   old_local_solution =
00053     AutoPtr<NumericVector<Number> >
00054       (&(this->add_vector("_transient_old_local_solution", true, SERIAL)));
00055   older_local_solution =
00056     AutoPtr<NumericVector<Number> >
00057       (&(this->add_vector("_transient_older_local_solution", true, SERIAL)));
00058 #endif
00059 }

template<class Base >
libMesh::TransientSystem< Base >::~TransientSystem (  )  [inline, virtual]

Destructor.

Definition at line 64 of file transient_system.C.

References libMesh::TransientSystem< Base >::clear(), libMesh::TransientSystem< Base >::old_local_solution, libMesh::TransientSystem< Base >::older_local_solution, and libMesh::AutoPtr< Tp >::release().

00065 {
00066   this->clear();
00067 
00068   // We still have AutoPtrs for API compatibility, but
00069   // now that we're System::add_vector()ing these, we can trust
00070   // the base class to handle memory management
00071   old_local_solution.release();
00072   older_local_solution.release();
00073 }


Member Function Documentation

template<class Base >
void libMesh::TransientSystem< Base >::clear (  )  [inline, virtual]

Clear all the data structures associated with the system.

Reimplemented in libMesh::TransientRBConstruction.

Definition at line 78 of file transient_system.C.

References libMesh::TransientSystem< Base >::old_local_solution, libMesh::TransientSystem< Base >::older_local_solution, and libMesh::AutoPtr< Tp >::release().

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

00079 {
00080   // clear the parent data
00081   Base::clear();
00082 
00083   // the old & older local solutions
00084   // are now deleted by System!
00085   // old_local_solution->clear();
00086   // older_local_solution->clear();
00087 
00088   // FIXME: This preserves maximum backwards compatibility,
00089   // but is probably grossly unnecessary:
00090   old_local_solution.release();
00091   older_local_solution.release();
00092 
00093   old_local_solution =
00094     AutoPtr<NumericVector<Number> >
00095       (&(this->add_vector("_transient_old_local_solution")));
00096   older_local_solution =
00097     AutoPtr<NumericVector<Number> >
00098       (&(this->add_vector("_transient_older_local_solution")));
00099 }

template<class Base >
void libMesh::TransientSystem< Base >::init_data (  )  [inline, protected, virtual]

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, libMesh::TransientSystem< Base >::old_local_solution, libMesh::TransientSystem< Base >::older_local_solution, and libMeshEnums::SERIAL.

00106 {
00107   // initialize parent data
00108   Base::init_data();
00109 
00110   // Initialize the old & older solutions
00111   // Using new ghosted vectors if enabled
00112 #ifdef LIBMESH_ENABLE_GHOSTED
00113   old_local_solution->init   (this->n_dofs(), this->n_local_dofs(),
00114                               this->get_dof_map().get_send_list(), false,
00115                               GHOSTED);
00116   older_local_solution->init (this->n_dofs(), this->n_local_dofs(),
00117                               this->get_dof_map().get_send_list(), false,
00118                               GHOSTED);
00119 #else
00120   old_local_solution->init   (this->n_dofs(), false, SERIAL);
00121   older_local_solution->init (this->n_dofs(), false, SERIAL);
00122 #endif
00123 }

template<class Base >
Number libMesh::TransientSystem< Base >::old_solution ( const dof_id_type  global_dof_number  )  const [inline]
Returns:
the old solution (at the previous timestep) for the specified global DOF.

Definition at line 177 of file transient_system.C.

References libMesh::TransientSystem< Base >::old_local_solution.

00178 {
00179   // Check the sizes
00180   libmesh_assert_less (global_dof_number, this->get_dof_map().n_dofs());
00181   libmesh_assert_less (global_dof_number, old_local_solution->size());
00182 
00183   return (*old_local_solution)(global_dof_number);
00184 }

template<class Base >
Number libMesh::TransientSystem< Base >::older_solution ( const dof_id_type  global_dof_number  )  const [inline]
Returns:
the older solution (two timesteps ago) for the specified global DOF.

Definition at line 189 of file transient_system.C.

References libMesh::TransientSystem< Base >::older_local_solution.

00190 {
00191   // Check the sizes
00192   libmesh_assert_less (global_dof_number, this->get_dof_map().n_dofs());
00193   libmesh_assert_less (global_dof_number, older_local_solution->size());
00194 
00195   return (*older_local_solution)(global_dof_number);
00196 }

template<class Base >
void libMesh::TransientSystem< Base >::re_update (  )  [inline, protected, virtual]

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.

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

00143 {
00144   // re_update the parent system
00145   Base::re_update ();
00146 
00147   const std::vector<dof_id_type>& send_list = this->get_dof_map().get_send_list ();
00148 
00149   const dof_id_type first_local_dof = Base::get_dof_map().first_dof();
00150   const dof_id_type end_local_dof  = Base::get_dof_map().end_dof();
00151 
00152   // Check sizes
00153   libmesh_assert_greater_equal (end_local_dof, first_local_dof);
00154   libmesh_assert_greater_equal (older_local_solution->size(), send_list.size());
00155   libmesh_assert_greater_equal (old_local_solution->size(), send_list.size());
00156 
00157   // Even if we don't have to do anything ourselves, localize() may
00158   // use parallel_only tools
00159   // if (first_local_dof == end_local_dof)
00160   //   return;
00161 
00162   // Update the old & older solutions with the send_list,
00163   // which may have changed since their last update.
00164   older_local_solution->localize (first_local_dof,
00165                                   end_local_dof-1,
00166                                   send_list);
00167 
00168   old_local_solution->localize (first_local_dof,
00169                                 end_local_dof-1,
00170                                 send_list);
00171 }

template<class Base >
void libMesh::TransientSystem< Base >::reinit (  )  [inline, 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.

00129 {
00130   // initialize parent data
00131   Base::reinit();
00132 
00133   // Project the old & older vectors to the new mesh
00134   // The System::reinit handles this now
00135   // this->project_vector (*old_local_solution);
00136   // this->project_vector (*older_local_solution);
00137 }

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.

00073 { return *this; }

template<class Base >
std::string libMesh::TransientSystem< Base >::system_type (  )  const [inline, virtual]
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.

00161 {
00162   std::string type = "Transient";
00163   type += Base::system_type ();
00164 
00165   return type;
00166 }


Member Data Documentation

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 >::clear(), libMesh::TransientSystem< Base >::init_data(), libMesh::TransientSystem< Base >::old_solution(), libMesh::TransientSystem< Base >::re_update(), libMesh::TransientSystem< Base >::TransientSystem(), and libMesh::TransientSystem< Base >::~TransientSystem().

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 >::clear(), libMesh::TransientSystem< Base >::init_data(), libMesh::TransientSystem< Base >::older_solution(), libMesh::TransientSystem< Base >::re_update(), libMesh::TransientSystem< Base >::TransientSystem(), and libMesh::TransientSystem< Base >::~TransientSystem().


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

Site Created By: libMesh Developers
Last modified: February 05 2013 19:55:41 UTC

Hosted By:
SourceForge.net Logo