Tpetra parallel linear algebra  Version of the Day
Public Member Functions | List of all members
Tpetra::Details::MultiVectorFillerData2< MV > Class Template Reference

Second implementation of fill and local assembly for MultiVectorFiller. More...

#include <Tpetra_MultiVectorFiller.hpp>

Inherits Describable.

Public Member Functions

 MultiVectorFillerData2 (const Teuchos::RCP< const map_type > &map, const Teuchos::EVerbosityLevel verbLevel=Teuchos::VERB_DEFAULT, const Teuchos::RCP< Teuchos::FancyOStream > &out=Teuchos::null)
 Default constructor (sets number of columns to zero). More...
 
 MultiVectorFillerData2 (const Teuchos::RCP< const map_type > &map, const size_t numColumns, const Teuchos::EVerbosityLevel verbLevel=Teuchos::VERB_DEFAULT, const Teuchos::RCP< Teuchos::FancyOStream > &out=Teuchos::null)
 Constructor. More...
 
Teuchos::Array< global_ordinal_type > getSourceIndices (const Teuchos::Comm< int > &comm, const Teuchos::RCP< Teuchos::FancyOStream > &out=Teuchos::null, const bool debug=false) const
 All source indices (local and nonlocal) of the source Map, sorted and unique. More...
 
void setNumColumns (const size_t newNumColumns)
 Set the number of columns in the output multivector. More...
 
void sumIntoGlobalValues (const Teuchos::ArrayView< const global_ordinal_type > &rows, const size_t columnIndex, const Teuchos::ArrayView< const scalar_type > &values)
 Set entry (rows[i],columnIndex) to values[i], for all i. More...
 
void sumIntoGlobalValues (const Teuchos::ArrayView< const global_ordinal_type > &rows, const Teuchos::ArrayView< const scalar_type > &values)
 Set entry (rows[i],j) to values[i], for all i and j. More...
 
template<class BinaryFunction >
void locallyAssemble (MV &X, BinaryFunction &f)
 Locally assemble into X, with user-specified combine mode. More...
 
void locallyAssemble (MV &X)
 Do the "local" (not MPI) part of assembly. More...
 
void clear ()
 Clear the contents of the multivector. More...
 

Detailed Description

template<class MV>
class Tpetra::Details::MultiVectorFillerData2< MV >

Second implementation of fill and local assembly for MultiVectorFiller.

Author
Mark Hoemmen
Template Parameters
MVSpecialization of Tpetra::MultiVector.

Definition at line 369 of file Tpetra_MultiVectorFiller.hpp.

Constructor & Destructor Documentation

template<class MV>
Tpetra::Details::MultiVectorFillerData2< MV >::MultiVectorFillerData2 ( const Teuchos::RCP< const map_type > &  map,
const Teuchos::EVerbosityLevel  verbLevel = Teuchos::VERB_DEFAULT,
const Teuchos::RCP< Teuchos::FancyOStream > &  out = Teuchos::null 
)
inline

Default constructor (sets number of columns to zero).

Parameters
map[in] Map over which to distribute the initial fill. This need not be the same Map as that of the multivector output of globalAssemble().

Before using this object, you should call setNumColumns() to set the number of columns in the output multivector. Otherwise, the two-argument version of sumIntoGlobalValues() won't actually do anything.

Definition at line 388 of file Tpetra_MultiVectorFiller.hpp.

template<class MV>
Tpetra::Details::MultiVectorFillerData2< MV >::MultiVectorFillerData2 ( const Teuchos::RCP< const map_type > &  map,
const size_t  numColumns,
const Teuchos::EVerbosityLevel  verbLevel = Teuchos::VERB_DEFAULT,
const Teuchos::RCP< Teuchos::FancyOStream > &  out = Teuchos::null 
)
inline

Constructor.

Parameters
map[in] Map over which to distribute the initial fill. This need not be the same Map as that of the multivector output of globalAssemble(), but the Map must have the same communicator as the multivector output of globalAssemble().
numColumns[in] The (expected) number of columns in the output multivector. You can always change this later by calling setNumColumns().
Note
If the number of columns given here is not the same as the number of columns in the output multivector, you should call setNumColumns() first before inserting any data. Otherwise, the two-argument version of sumIntoGlobalValues() won't do the right thing.

Definition at line 414 of file Tpetra_MultiVectorFiller.hpp.

Member Function Documentation

template<class MV>
Teuchos::Array<global_ordinal_type> Tpetra::Details::MultiVectorFillerData2< MV >::getSourceIndices ( const Teuchos::Comm< int > &  comm,
const Teuchos::RCP< Teuchos::FancyOStream > &  out = Teuchos::null,
const bool  debug = false 
) const
inline

All source indices (local and nonlocal) of the source Map, sorted and unique.

Definition at line 525 of file Tpetra_MultiVectorFiller.hpp.

template<class MV>
void Tpetra::Details::MultiVectorFillerData2< MV >::setNumColumns ( const size_t  newNumColumns)
inline

Set the number of columns in the output multivector.

Parameters
newNumColumns[in] The new number of columns in the multivector. Zero is allowed; it means "clear local storage."

Setting the number of columns to zero effectively clears out all local storage, but may not necessarily deallocate nonlocal storage. Call clear() to clear out all nonlocal storage.

Definition at line 624 of file Tpetra_MultiVectorFiller.hpp.

template<class MV>
void Tpetra::Details::MultiVectorFillerData2< MV >::sumIntoGlobalValues ( const Teuchos::ArrayView< const global_ordinal_type > &  rows,
const size_t  columnIndex,
const Teuchos::ArrayView< const scalar_type > &  values 
)
inline

Set entry (rows[i],columnIndex) to values[i], for all i.

Parameters
rows[in] Which rows of the MultiVector to modify.
columnIndex[in] Which column of the MultiVector to modify.
values[in] The new values.

Definition at line 667 of file Tpetra_MultiVectorFiller.hpp.

template<class MV>
void Tpetra::Details::MultiVectorFillerData2< MV >::sumIntoGlobalValues ( const Teuchos::ArrayView< const global_ordinal_type > &  rows,
const Teuchos::ArrayView< const scalar_type > &  values 
)
inline

Set entry (rows[i],j) to values[i], for all i and j.

Data for each column are stored contiguously in rows and in values. Thus, rows and values are in rowwise order, even though they may be stored in columnwise order in the multivector.

Be sure that the number of columns is set correctly before calling this.

Definition at line 736 of file Tpetra_MultiVectorFiller.hpp.

template<class MV>
template<class BinaryFunction >
void Tpetra::Details::MultiVectorFillerData2< MV >::locallyAssemble ( MV &  X,
BinaryFunction &  f 
)
inline

Locally assemble into X, with user-specified combine mode.

Parameters
X[in/out] Multivector (overlapping source distribution).
f[in/out] Binary function that defines the combine mode. It must define scalar_type operator (const scalar_type&, const scalar_type&). It need not necessarily be commutative or even associative, but it should be thread-safe in case we decide to parallelize local assembly. We call it via X(i,j) = f(X(i,j), Y(i,j)), so write your possibly nonassociative or noncommutative operation accordingly.

X is distributed by the source Map (with possible overlap) of the Export operation. The source Map of the Export includes both the elements owned by this object's constructor's input Map, and the indices inserted by sumIntoGlobalValues().

Precondition: The set of global indices in X's Map equals the union of the global indices in map_ and (the union of the entries of nonlocalIndices_[j] for all valid columns j).

Note
You can get the usual Tpetra::ADD combine mode by supplying f = std::plus<scalar_type>.

Definition at line 776 of file Tpetra_MultiVectorFiller.hpp.

template<class MV>
void Tpetra::Details::MultiVectorFillerData2< MV >::locallyAssemble ( MV &  X)
inline

Do the "local" (not MPI) part of assembly.

Call this method for the usual Tpetra::ADD combine mode. If you want a different combine mode, call the overload that takes two arguments, one of which is a binary function.

Definition at line 838 of file Tpetra_MultiVectorFiller.hpp.

template<class MV>
void Tpetra::Details::MultiVectorFillerData2< MV >::clear ( )
inline

Clear the contents of the multivector.

This fills the vector with zeros, and also removes nonlocal data. It does not deallocate all storage. For that, you need to set the number of columns to zero.

Definition at line 849 of file Tpetra_MultiVectorFiller.hpp.


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