Thyra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Related Functions | List of all members
Thyra::ParameterDrivenMultiVectorInput< Scalar > Class Template Reference

Concrete utility class that an ANA can use for reading in a (multi)vector as directed by a parameter sublist. More...

#include <Thyra_ParameterDrivenMultiVectorInput.hpp>

Inheritance diagram for Thyra::ParameterDrivenMultiVectorInput< Scalar >:
Inheritance graph
[legend]

Related Functions

(Note that these are not member functions.)

template<class Scalar >
RCP< const VectorBase< Scalar > > readVectorOverride (const ParameterDrivenMultiVectorInput< Scalar > &pdmvi, const std::string &vName, const RCP< const VectorBase< Scalar > > &defaultVector)
 Read a vector and override if one is read. More...
 

Constructors/Initializers

 ParameterDrivenMultiVectorInput ()
 
 STANDARD_CONST_COMPOSITION_MEMBERS (VectorSpaceBase< Scalar >, vecSpc)
 Set the vector space used to create the (multi)vectors that are read in. More...
 
 STANDARD_COMPOSITION_MEMBERS (MultiVectorFileIOBase< Scalar >, fileIO)
 Set the MultiVectorFileIOBase object that will be used to read the vector from file(s). More...
 

Overridden from ParameterListAcceptor

void setParameterList (Teuchos::RCP< Teuchos::ParameterList > const &paramList)
 
Teuchos::RCP
< Teuchos::ParameterList
getNonconstParameterList ()
 
Teuchos::RCP
< Teuchos::ParameterList
unsetParameterList ()
 
Teuchos::RCP< const
Teuchos::ParameterList
getParameterList () const
 
Teuchos::RCP< const
Teuchos::ParameterList
getValidParameters () const
 

Informational

const std::string & readinFileNameBase () const
 Return the value of the parameter "File Name Base" that was read in from the setParameterList() function. More...
 
const Teuchos::Array< Scalar > & readinExplicitArray () const
 Return the value of the parameter "Explicit Array" that was read in from the setParameterList() function. More...
 
Scalar readinScaleBy () const
 Return the value of the parameter "Explicit Array" that was read in from the setParameterList() function. More...
 

(Multi)Vector Readers

bool readMultiVector (const std::string &mvName, Thyra::MultiVectorBase< Scalar > *mv) const
 Read a MultiVector that has already been allocated, as directed by the set parameter sublist. More...
 
bool readVector (const std::string &vName, Teuchos::RCP< Thyra::VectorBase< Scalar > > *v) const
 Read a Vector as directed by the set parameter sublist, allocating the Vector object if it has not already been allocated. More...
 
Teuchos::RCP
< Thyra::VectorBase< Scalar > > 
readVector (const std::string &vName) const
 Read a newly allocated Vector as directed by the set parameter sublist. More...
 

Detailed Description

template<class Scalar>
class Thyra::ParameterDrivenMultiVectorInput< Scalar >

Concrete utility class that an ANA can use for reading in a (multi)vector as directed by a parameter sublist.

This class is made one-hundred percent general for all ANAs by accepting an abstract MultiVectorFileIOBase object that actually reads the (multi)vectors from file(s) (or whatever implementation is used for the storage of the (multi)vectors).

This class can also read in small (multi)vectors directly from the parameter sublist (see getValidParameters()).

Note that in order to use objects of this type, the client must minimally set the vector space using set_vecSpc() before any vectors can be extracted and if file IO is performed, then a MultiVectorFileIOBase object must be set using set_fileIO(). Note that the parameter sublist can be set using setParameterList() without first setting any of these two objects. In other words, this object can accept a parameter list without knowing anything about the actually type of the (multi)vector that will be read using the readMultiVector() or readVector() functions called later.

This simple utility class is not meant to be too fancy so please just study the actual implementation to see what this class does.

ToDo: When needed, implement a function that can read a multi-vector of any number of columns based on the number of columns stored in the file.

ToDo: When needed, add the ability to read in a multi-vector with more than one column directly from the array parameter.

Definition at line 89 of file Thyra_ParameterDrivenMultiVectorInput.hpp.

Constructor & Destructor Documentation

Definition at line 364 of file Thyra_ParameterDrivenMultiVectorInput.hpp.

Member Function Documentation

template<class Scalar>
Thyra::ParameterDrivenMultiVectorInput< Scalar >::STANDARD_CONST_COMPOSITION_MEMBERS ( VectorSpaceBase< Scalar >  ,
vecSpc   
)

Set the vector space used to create the (multi)vectors that are read in.

template<class Scalar>
Thyra::ParameterDrivenMultiVectorInput< Scalar >::STANDARD_COMPOSITION_MEMBERS ( MultiVectorFileIOBase< Scalar >  ,
fileIO   
)

Set the MultiVectorFileIOBase object that will be used to read the vector from file(s).

template<class Scalar >
void Thyra::ParameterDrivenMultiVectorInput< Scalar >::setParameterList ( Teuchos::RCP< Teuchos::ParameterList > const &  paramList)
virtual
template<class Scalar >
Teuchos::RCP< Teuchos::ParameterList > Thyra::ParameterDrivenMultiVectorInput< Scalar >::getNonconstParameterList ( )
virtual
template<class Scalar >
Teuchos::RCP< Teuchos::ParameterList > Thyra::ParameterDrivenMultiVectorInput< Scalar >::unsetParameterList ( )
virtual
template<class Scalar >
Teuchos::RCP< const Teuchos::ParameterList > Thyra::ParameterDrivenMultiVectorInput< Scalar >::getParameterList ( ) const
virtual

Reimplemented from Teuchos::ParameterListAcceptor.

Definition at line 413 of file Thyra_ParameterDrivenMultiVectorInput.hpp.

template<class Scalar >
Teuchos::RCP< const Teuchos::ParameterList > Thyra::ParameterDrivenMultiVectorInput< Scalar >::getValidParameters ( ) const
virtual

Reimplemented from Teuchos::ParameterListAcceptor.

Definition at line 420 of file Thyra_ParameterDrivenMultiVectorInput.hpp.

template<class Scalar >
const std::string & Thyra::ParameterDrivenMultiVectorInput< Scalar >::readinFileNameBase ( ) const
inline

Return the value of the parameter "File Name Base" that was read in from the setParameterList() function.

Definition at line 288 of file Thyra_ParameterDrivenMultiVectorInput.hpp.

template<class Scalar >
const Teuchos::Array< Scalar > & Thyra::ParameterDrivenMultiVectorInput< Scalar >::readinExplicitArray ( ) const
inline

Return the value of the parameter "Explicit Array" that was read in from the setParameterList() function.

Definition at line 296 of file Thyra_ParameterDrivenMultiVectorInput.hpp.

template<class Scalar >
Scalar Thyra::ParameterDrivenMultiVectorInput< Scalar >::readinScaleBy ( ) const
inline

Return the value of the parameter "Explicit Array" that was read in from the setParameterList() function.

Definition at line 304 of file Thyra_ParameterDrivenMultiVectorInput.hpp.

template<class Scalar >
bool Thyra::ParameterDrivenMultiVectorInput< Scalar >::readMultiVector ( const std::string &  mvName,
Thyra::MultiVectorBase< Scalar > *  mv 
) const

Read a MultiVector that has already been allocated, as directed by the set parameter sublist.

Parameters
mvName[in] The name of the multi-vector being read. This string name is added to any exception messages that are thrown and is printed to getDefaultOStream() if verbosity is turned on.
mv[in/out] The multi-vector to be read.

Preconditions:

  • this->getParameterList().get()!=NULL
  • this->get_vecSpc().get()!=NULL
  • [this->readinFileNameBase().length() > 0] this->get_fileIO().get()!=NULL
  • mv!=NULL
  • this->vecSpc().isCompatible(*mv->range())==true
Returns
true if a vector was read, false otherwise.

Definition at line 457 of file Thyra_ParameterDrivenMultiVectorInput.hpp.

template<class Scalar >
bool Thyra::ParameterDrivenMultiVectorInput< Scalar >::readVector ( const std::string &  vName,
Teuchos::RCP< Thyra::VectorBase< Scalar > > *  v 
) const

Read a Vector as directed by the set parameter sublist, allocating the Vector object if it has not already been allocated.

Parameters
vName[in] The name of the vector being read. This string name is added to any exception messages that are thrown and is printed to getDefaultOStream() if verbosity is turned on.
v[in/out] RCP to the vector to be read. If v->get()==NULL before this function is called, then a new vector object will be allocated and set on return. On return *(*v) will contain the values read as specified by the parameter sublist.

Preconditions:

  • this->getParameterList().get()!=NULL
  • this->get_vecSpc().get()!=NULL
  • [this->readinFileNameBase().length() > 0] this->get_fileIO().get()!=NULL
  • v!=NULL
  • [v->get()!=NULL] this->vecSpc().isCompatible(*(*v)->space())==true

Postconditions:

  • If v->get()==NULL on input no vector was read, then v->get()==NULL on output.
  • If v->get()==NULL on input a vector was read, then v->get()!=NULL on output.
Returns
true if a vector was read, false otherwise.

This function helps to avoid reallocations on multiple reads so that the same memory can be used over and over again.

This function simply calls the above readMultiVector() function but it allocates a Vector object instead of a multi-vector object.

Definition at line 512 of file Thyra_ParameterDrivenMultiVectorInput.hpp.

template<class Scalar >
Teuchos::RCP< Thyra::VectorBase< Scalar > > Thyra::ParameterDrivenMultiVectorInput< Scalar >::readVector ( const std::string &  vName) const

Read a newly allocated Vector as directed by the set parameter sublist.

This function just calls the above readVector() function (see its preconditions).

Returns
returnVal.get()!=NULL if a vector was read and returnVal.get()==NULL if no vector was read.

Definition at line 529 of file Thyra_ParameterDrivenMultiVectorInput.hpp.

Friends And Related Function Documentation

template<class Scalar >
RCP< const VectorBase< Scalar > > readVectorOverride ( const ParameterDrivenMultiVectorInput< Scalar > &  pdmvi,
const std::string &  vName,
const RCP< const VectorBase< Scalar > > &  defaultVector 
)
related

Read a vector and override if one is read.

Definition at line 268 of file Thyra_ParameterDrivenMultiVectorInput.hpp.


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