Thyra Package Browser (Single Doxygen Collection) Version of the Day
Private Attributes | Static Private Attributes | Related Functions
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]

List of all members.

Private Attributes

Teuchos::RCP< const
Teuchos::ParameterList > 
validParamList_
Teuchos::RCP
< Teuchos::ParameterList > 
paramList_
std::string fileNameBase_
Teuchos::Array< Scalar > explicitArray_
Scalar scaleBy_
Scalar addScalar_

Static Private Attributes

static const std::string FileNameBase_name_ = "File Name Base"
static const std::string FileNameBase_default_ = ""
static const std::string ExplicitArray_name_ = "Explicit Array"
static const std::string ExplicitArray_default_ = "{}"
static const std::string ScaleBy_name_ = "Scale By"
static const double ScaleBy_default_ = 1.0
static const std::string AddScalar_name_ = "Add Scalar"
static const double AddScalar_default_ = 0.0

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.

Constructors/Initializers

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

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.
const Teuchos::Array< Scalar > & readinExplicitArray () const
 Return the value of the parameter "Explicit Array" that was read in from the setParameterList() function.
Scalar readinScaleBy () const
 Return the value of the parameter "Explicit Array" that was read in from the setParameterList() function.

(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.
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.
Teuchos::RCP
< Thyra::VectorBase< Scalar > > 
readVector (const std::string &vName) const
 Read a newly allocated Vector as directed by the set parameter sublist.

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 76 of file Thyra_ParameterDrivenMultiVectorInput.hpp.


Constructor & Destructor Documentation

Definition at line 351 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)

Definition at line 360 of file Thyra_ParameterDrivenMultiVectorInput.hpp.

template<class Scalar >
Teuchos::RCP< Teuchos::ParameterList > Thyra::ParameterDrivenMultiVectorInput< Scalar >::getNonconstParameterList ( )

Definition at line 383 of file Thyra_ParameterDrivenMultiVectorInput.hpp.

template<class Scalar >
Teuchos::RCP< Teuchos::ParameterList > Thyra::ParameterDrivenMultiVectorInput< Scalar >::unsetParameterList ( )

Definition at line 390 of file Thyra_ParameterDrivenMultiVectorInput.hpp.

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

Definition at line 400 of file Thyra_ParameterDrivenMultiVectorInput.hpp.

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

Definition at line 407 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 275 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 283 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 291 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 444 of file Thyra_ParameterDrivenMultiVectorInput.hpp.

References Thyra::MultiVectorBase< Scalar >::col(), Thyra::PDMVIUtilityPack::copy(), Thyra::LinearOpBase< Scalar >::domain(), Thyra::Vp_S(), and Thyra::Vt_S().

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 499 of file Thyra_ParameterDrivenMultiVectorInput.hpp.

Referenced by Thyra::ParameterDrivenMultiVectorInput< Scalar >::readVectorOverride().

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 516 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 255 of file Thyra_ParameterDrivenMultiVectorInput.hpp.

References Thyra::ParameterDrivenMultiVectorInput< Scalar >::readVector().


Member Data Documentation

template<class Scalar>
Teuchos::RCP<const Teuchos::ParameterList> Thyra::ParameterDrivenMultiVectorInput< Scalar >::validParamList_ [mutable, private]

Definition at line 226 of file Thyra_ParameterDrivenMultiVectorInput.hpp.

template<class Scalar>
Teuchos::RCP<Teuchos::ParameterList> Thyra::ParameterDrivenMultiVectorInput< Scalar >::paramList_ [private]

Definition at line 227 of file Thyra_ParameterDrivenMultiVectorInput.hpp.

template<class Scalar>
std::string Thyra::ParameterDrivenMultiVectorInput< Scalar >::fileNameBase_ [private]

Definition at line 229 of file Thyra_ParameterDrivenMultiVectorInput.hpp.

template<class Scalar>
Teuchos::Array<Scalar> Thyra::ParameterDrivenMultiVectorInput< Scalar >::explicitArray_ [private]

Definition at line 230 of file Thyra_ParameterDrivenMultiVectorInput.hpp.

template<class Scalar>
Scalar Thyra::ParameterDrivenMultiVectorInput< Scalar >::scaleBy_ [private]

Definition at line 231 of file Thyra_ParameterDrivenMultiVectorInput.hpp.

template<class Scalar>
Scalar Thyra::ParameterDrivenMultiVectorInput< Scalar >::addScalar_ [private]

Definition at line 232 of file Thyra_ParameterDrivenMultiVectorInput.hpp.

template<class Scalar>
const std::string Thyra::ParameterDrivenMultiVectorInput< Scalar >::FileNameBase_name_ = "File Name Base" [static, private]

Definition at line 234 of file Thyra_ParameterDrivenMultiVectorInput.hpp.

template<class Scalar>
const std::string Thyra::ParameterDrivenMultiVectorInput< Scalar >::FileNameBase_default_ = "" [static, private]

Definition at line 235 of file Thyra_ParameterDrivenMultiVectorInput.hpp.

template<class Scalar>
const std::string Thyra::ParameterDrivenMultiVectorInput< Scalar >::ExplicitArray_name_ = "Explicit Array" [static, private]

Definition at line 237 of file Thyra_ParameterDrivenMultiVectorInput.hpp.

template<class Scalar>
const std::string Thyra::ParameterDrivenMultiVectorInput< Scalar >::ExplicitArray_default_ = "{}" [static, private]

Definition at line 238 of file Thyra_ParameterDrivenMultiVectorInput.hpp.

template<class Scalar>
const std::string Thyra::ParameterDrivenMultiVectorInput< Scalar >::ScaleBy_name_ = "Scale By" [static, private]

Definition at line 240 of file Thyra_ParameterDrivenMultiVectorInput.hpp.

template<class Scalar>
const double Thyra::ParameterDrivenMultiVectorInput< Scalar >::ScaleBy_default_ = 1.0 [static, private]

Definition at line 241 of file Thyra_ParameterDrivenMultiVectorInput.hpp.

template<class Scalar>
const std::string Thyra::ParameterDrivenMultiVectorInput< Scalar >::AddScalar_name_ = "Add Scalar" [static, private]

Definition at line 243 of file Thyra_ParameterDrivenMultiVectorInput.hpp.

template<class Scalar>
const double Thyra::ParameterDrivenMultiVectorInput< Scalar >::AddScalar_default_ = 0.0 [static, private]

Definition at line 244 of file Thyra_ParameterDrivenMultiVectorInput.hpp.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines