Poster of Linux kernelThe best gift for a Linux geek
TransientSystem

TransientSystem

Section: C Library Functions (3) Updated: Thu Apr 7 2011
Local index Up
 

NAME

TransientSystem -  

SYNOPSIS


#include <transient_system.h>  

Public Types


typedef TransientSystem< Base > sys_type
 

Public Member Functions


TransientSystem (EquationSystems &es, const std::string &name, const unsigned int number)

virtual ~TransientSystem ()

sys_type & system ()

virtual void clear ()

virtual void reinit ()

virtual std::string system_type () const

Number old_solution (const unsigned int global_dof_number) const

Number older_solution (const unsigned int 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 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 47 of file transient_system.h.  

Member Typedef Documentation

 

template<class Base > typedef TransientSystem<Base> TransientSystem< Base >::sys_typeThe type of system.

Definition at line 67 of file transient_system.h.  

Constructor & Destructor Documentation

 

template<class Base > TransientSystem< Base >::TransientSystem (EquationSystems &es, const std::string &name, const unsigned intnumber)Constructor. Initializes required data structures.

Definition at line 37 of file transient_system.C.

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

                                                                   :
  
  Base                 (es, name, number)
{
  old_local_solution =
    AutoPtr<NumericVector<Number> >
      (&(this->add_vector('_transient_old_local_solution')));
  older_local_solution =
    AutoPtr<NumericVector<Number> >
      (&(this->add_vector('_transient_older_local_solution')));
}
 

template<class Base > TransientSystem< Base >::~TransientSystem () [virtual]Destructor.

Definition at line 54 of file transient_system.C.

{
  this->clear();

  // We still have AutoPtrs for API compatibility, but
  // now that we're System::add_vector()ing these, we can trust
  // the base class to handle memory management
  old_local_solution.release();  
  older_local_solution.release();  
}
 

Member Function Documentation

 

template<class Base > void TransientSystem< Base >::clear () [virtual]Clear all the data structures associated with the system.

Definition at line 68 of file transient_system.C.

{
  // clear the parent data
  Base::clear();

  // the old & older local solutions
  // are now deleted by System!
  // old_local_solution->clear();
  // older_local_solution->clear();  

  // FIXME: This preserves maximum backwards compatibility,
  // but is probably grossly unnecessary:
  old_local_solution.release();  
  older_local_solution.release();  

  old_local_solution =
    AutoPtr<NumericVector<Number> >
      (&(this->add_vector('_transient_old_local_solution')));
  older_local_solution =
    AutoPtr<NumericVector<Number> >
      (&(this->add_vector('_transient_older_local_solution')));
}
 

template<class Base > void TransientSystem< Base >::init_data () [protected, virtual]Initializes the member data fields associated with the system, so that, e.g., assemble() may be used.

Definition at line 95 of file transient_system.C.

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

{
  // initialize parent data
  Base::init_data();

  // Initialize the old & older solutions
  // Using new ghosted vectors if enabled
#ifdef LIBMESH_ENABLE_GHOSTED
  old_local_solution->init   (this->n_dofs(), this->n_local_dofs(),
                              this->get_dof_map().get_send_list(), false,
                              GHOSTED);
  older_local_solution->init (this->n_dofs(), this->n_local_dofs(),
                              this->get_dof_map().get_send_list(), false,
                              GHOSTED);
#else
  old_local_solution->init   (this->n_dofs(), false, SERIAL);
  older_local_solution->init (this->n_dofs(), false, SERIAL);
#endif
}
 

template<class Base > Number TransientSystem< Base >::old_solution (const unsigned intglobal_dof_number) constReturns:

the old solution (at the previous timestep) for the specified global DOF.

Definition at line 171 of file transient_system.C.

{
  // Check the sizes
  libmesh_assert (global_dof_number < this->get_dof_map().n_dofs());
  libmesh_assert (global_dof_number < old_local_solution->size());
   
  return (*old_local_solution)(global_dof_number);
}
 

template<class Base > Number TransientSystem< Base >::older_solution (const unsigned intglobal_dof_number) constReturns:

the older solution (two timesteps ago) for the specified global DOF.

Definition at line 183 of file transient_system.C.

{
  // Check the sizes
  libmesh_assert (global_dof_number < this->get_dof_map().n_dofs());
  libmesh_assert (global_dof_number < older_local_solution->size());
   
  return (*older_local_solution)(global_dof_number);
}
 

template<class Base > void TransientSystem< Base >::re_update () [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 132 of file transient_system.C.

References Utility::iota().

{
  // re_update the parent system
  Base::re_update ();
  
  //const std::vector<unsigned int>& send_list = Base::_dof_map.get_send_list ();

  // Explicitly build a send_list
  std::vector<unsigned int> send_list(Base::solution->size());
  Utility::iota (send_list.begin(), send_list.end(), 0);
  
  const unsigned int first_local_dof = Base::get_dof_map().first_dof();
  const unsigned int end_local_dof  = Base::get_dof_map().end_dof();

  // Check sizes
  libmesh_assert (end_local_dof >= first_local_dof);
  libmesh_assert (send_list.size() >= end_local_dof - first_local_dof);
  libmesh_assert (older_local_solution->size() >= send_list.size());
  libmesh_assert (old_local_solution->size()   >= send_list.size());

  // Make sure we have something to do
  if (first_local_dof == end_local_dof)
    return;
  
  // Update the old & older solutions with the send_list,
  // which may have changed since their last update.
  older_local_solution->localize (first_local_dof,
                                  end_local_dof-1,
                                  send_list);
  
  old_local_solution->localize (first_local_dof,
                                end_local_dof-1,
                                send_list);  
}
 

template<class Base > void TransientSystem< Base >::reinit () [virtual]Reinitializes the member data fields associated with the system, so that, e.g., assemble() may be used.

Definition at line 118 of file transient_system.C.

{
  // initialize parent data
  Base::reinit();
    
  // Project the old & older vectors to the new mesh
  // The System::reinit handles this now
  // this->project_vector (*old_local_solution);
  // this->project_vector (*older_local_solution);
}
 

template<class Base > sys_type& TransientSystem< Base >::system () [inline]Returns:

a clever pointer to the system.

Definition at line 72 of file transient_system.h.

{ return *this; }
 

template<class Base > std::string 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 158 of file transient_system.h.

{
  std::string type = 'Transient';
  type += Base::system_type ();
  
  return type;
}
 

Member Data Documentation

 

template<class Base > AutoPtr<NumericVector<Number> > TransientSystem< Base >::old_local_solutionAll 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 115 of file transient_system.h.

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

template<class Base > AutoPtr<NumericVector<Number> > TransientSystem< Base >::older_local_solutionAll 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 123 of file transient_system.h.

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

 

Author

Generated automatically by Doxygen for libMesh from the source code.


 

Index

NAME
SYNOPSIS
Public Types
Public Member Functions
Public Attributes
Protected Member Functions
Detailed Description
template<class Base> class TransientSystem< Base >
Member Typedef Documentation
template<class Base > typedef TransientSystem<Base> TransientSystem< Base >::sys_typeThe type of system.
Constructor & Destructor Documentation
template<class Base > TransientSystem< Base >::TransientSystem (EquationSystems &es, const std::string &name, const unsigned intnumber)Constructor. Initializes required data structures.
template<class Base > TransientSystem< Base >::~TransientSystem () [virtual]Destructor.
Member Function Documentation
template<class Base > void TransientSystem< Base >::clear () [virtual]Clear all the data structures associated with the system.
template<class Base > void TransientSystem< Base >::init_data () [protected, virtual]Initializes the member data fields associated with the system, so that, e.g., assemble() may be used.
template<class Base > Number TransientSystem< Base >::old_solution (const unsigned intglobal_dof_number) constReturns:
template<class Base > Number TransientSystem< Base >::older_solution (const unsigned intglobal_dof_number) constReturns:
template<class Base > void TransientSystem< Base >::re_update () [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.
template<class Base > void TransientSystem< Base >::reinit () [virtual]Reinitializes the member data fields associated with the system, so that, e.g., assemble() may be used.
template<class Base > sys_type& TransientSystem< Base >::system () [inline]Returns:
template<class Base > std::string TransientSystem< Base >::system_type () const [inline, virtual]Returns:
Member Data Documentation
template<class Base > AutoPtr<NumericVector<Number> > TransientSystem< Base >::old_local_solutionAll 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.
template<class Base > AutoPtr<NumericVector<Number> > TransientSystem< Base >::older_local_solutionAll 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.
Author

This document was created by man2html, using the manual pages.
Time: 21:57:45 GMT, April 16, 2011