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

Abstract strategy interface for reading and writing (multi)vector objects to and from files. More...

#include <Thyra_MultiVectorFileIOBase.hpp>

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

Public Member Functions

virtual bool isCompatible (const MultiVectorBase< Scalar > &mv) const =0
 Return if the given multi-vector is compatible with this implementation. More...
 
virtual void readMultiVectorFromFile (const std::string &fileNameBase, Thyra::MultiVectorBase< Scalar > *mv) const =0
 Read a (multi)vector from a file given the file base name. More...
 
virtual void writeMultiVectorToFile (const Thyra::MultiVectorBase< Scalar > &mv, const std::string &fileNameBase) const =0
 Write a (multi)vector to a file given the file base name. More...
 

Related Functions

(Note that these are not member functions.)

template<class Scalar >
Teuchos::RCP< VectorBase
< Scalar > > 
readVectorFromFile (const MultiVectorFileIOBase< Scalar > &fileIO, const std::string &fileNameBase, const VectorSpaceBase< Scalar > &vecSpc)
 Read a vector from file(s) given the file base name and a vector space. More...
 

Detailed Description

template<class Scalar>
class Thyra::MultiVectorFileIOBase< Scalar >

Abstract strategy interface for reading and writing (multi)vector objects to and from files.

The concept of a file is every general and really can be implemented as any type of object data base that is keyed on a string name (i.e. fileNameBase). In that sense, this interface is really an interface to a general multi-vector serialization/deserialization implementation, but file-based implementations are expected to be the most common.

This interface currently requires the client to know the correct vector space and to pre-create the multi-vectors with the right number of columns before they can be read in. In all current use cases where this interface is used, the client knows what it needs to read so this is fine.

ToDo: Add a form of readMultiFromFile(...) that will accept just a vector space and will create a multi-vector with as many columns as is specified in the file. Right now I don't know this functionality so I am not going to implement this. However, if an important use case is found where this functionality is needed, then we can add this implementation without much trouble.

ToDo: Derive this interface from Teuchos::ParameterListAcceptor so that we can set some options on how the reading and writing gets done (e.g. use binary or ASCII formating).

Definition at line 82 of file Thyra_MultiVectorFileIOBase.hpp.

Member Function Documentation

template<class Scalar>
virtual bool Thyra::MultiVectorFileIOBase< Scalar >::isCompatible ( const MultiVectorBase< Scalar > &  mv) const
pure virtual

Return if the given multi-vector is compatible with this implementation.

Implemented in Thyra::DefaultSpmdMultiVectorFileIO< Scalar >.

template<class Scalar>
virtual void Thyra::MultiVectorFileIOBase< Scalar >::readMultiVectorFromFile ( const std::string &  fileNameBase,
Thyra::MultiVectorBase< Scalar > *  mv 
) const
pure virtual

Read a (multi)vector from a file given the file base name.

Parameters
fileNameBase[in] The base name of the file(s) that will be used to read the multi-vector from.
mv[in/out] On output, this multi-vector will be filled with the values from the given file(s). This multi-vector must have already been created and structured in such a way that is compatible with the format of the multi-vector stored in the given file and the implementation of this interface.

Preconditions:

  • mv!=NULL
  • this->isCompatible(*mv)==true.

Implemented in Thyra::DefaultSpmdMultiVectorFileIO< Scalar >.

template<class Scalar>
virtual void Thyra::MultiVectorFileIOBase< Scalar >::writeMultiVectorToFile ( const Thyra::MultiVectorBase< Scalar > &  mv,
const std::string &  fileNameBase 
) const
pure virtual

Write a (multi)vector to a file given the file base name.

Parameters
mv[in] The multi-vector that will be written to file(s).
fileNameBase[in] The base name of the file(s) that will written to with the values of the multi-vector.

Preconditions:

  • this->isCompatible(mv)==true.

Implemented in Thyra::DefaultSpmdMultiVectorFileIO< Scalar >.

Friends And Related Function Documentation

template<class Scalar >
Teuchos::RCP< VectorBase< Scalar > > readVectorFromFile ( const MultiVectorFileIOBase< Scalar > &  fileIO,
const std::string &  fileNameBase,
const VectorSpaceBase< Scalar > &  vecSpc 
)
related

Read a vector from file(s) given the file base name and a vector space.

Definition at line 140 of file Thyra_MultiVectorFileIOBase.hpp.


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