queso-0.53.0
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
QUESO::VectorSpace< V, M > Class Template Reference

A class representing a vector space. More...

#include <VectorSet.h>

Inheritance diagram for QUESO::VectorSpace< V, M >:
Inheritance graph
[legend]
Collaboration diagram for QUESO::VectorSpace< V, M >:
Collaboration graph
[legend]

Public Member Functions

template<>
GslVectornewVector () const
 
template<>
GslVectornewVector (double value) const
 
template<>
GslMatrixnewMatrix () const
 
template<>
GslMatrixnewDiagMatrix (double diagValue) const
 
Constructor/Destructor methods
 VectorSpace (const BaseEnvironment &env, const char *prefix, unsigned int dimGlobalValue, const std::vector< std::string > *componentsNamesVec)
 Shaped constructor. More...
 
 VectorSpace (const VectorSpace< V, M > &aux)
 Copy constructor. More...
 
 ~VectorSpace ()
 Destructor. More...
 
Attribute methods
const BaseEnvironmentenv () const
 Environment. More...
 
const Mapmap () const
 Map. More...
 
unsigned int numOfProcsForStorage () const
 Returns total number of processes. More...
 
unsigned int dimLocal () const
 
unsigned int dimGlobal () const
 
unsigned int globalIdOfFirstComponent () const
 
Mathematical methods
const V & zeroVector () const
 Returns a vector filled with zeros. More...
 
V * newVector () const
 Creates an empty vector of size given by Map& map. See template specialization. More...
 
V * newVector (double value) const
 Creates a vector of size given by Map& map and all values give by value. See template specialization. More...
 
V * newVector (const V &v) const
 Creates vector as a copy of another. More...
 
M * newMatrix () const
 Creates an empty matrix of size given by Map& map. See template specialization. More...
 
M * newDiagMatrix (const V &v) const
 Creates a diagonal matrix with the elements and size of vector v. More...
 
M * newDiagMatrix (double diagValue) const
 Creates a diagonal matrix with the elements diagValue and size given by Map& map. See template specialization. More...
 
M * newProposalMatrix (const V *varVec, const V *auxVec) const
 Creates a diagonal matrix conditionally to values from vector varVec, guaranteeing that its values are neither 0, NAN nor INFINITY. More...
 
const VectorSpace< V, M > & vectorSpace () const
 Accessor method to this. Vector space to which this vector set belongs to. More...
 
bool contains (const V &vec) const
 Whether vector contains vector vec. More...
 
const DistArray< std::string > * componentsNamesArray () const
 Access to private attribute m_componentsNamesArray, which is an instance of DistArray. More...
 
const std::vector< std::string > * componentsNamesVec () const
 Access to private attribute m_componentsNamesVec. More...
 
const std::string & localComponentName (unsigned int localComponentId) const
 Returns the local component names. More...
 
I/O methods
void printComponentsNames (std::ostream &os, bool printHorizontally) const
 Prints the local component names. More...
 
void print (std::ostream &os) const
 Prints only a message. More...
 
- Public Member Functions inherited from QUESO::VectorSet< V, M >
 VectorSet (const BaseEnvironment &env, const char *prefix, double volume)
 Shaped constructor. More...
 
virtual ~VectorSet ()
 Virtual destructor. More...
 
const BaseEnvironmentenv () const
 Environment. Access to private attribute m_env. More...
 
const std::string & prefix () const
 Access to private attribute m_prefix. More...
 
double volume () const
 Set volume; access to private attribute m_volume. More...
 

Protected Member Functions

MapnewMap ()
 Creates a new map. See template specialization. More...
 
template<>
MapnewMap ()
 

Protected Attributes

unsigned int m_dimGlobal
 Global dimension. More...
 
const Mapm_map
 Map. More...
 
unsigned int m_dimLocal
 Local dimension (number of elements owned by the calling processor.). More...
 
DistArray< std::string > * m_componentsNamesArray
 Array of strings of the type DistArray to store the names of the components. More...
 
DistArray< std::string > * m_componentsNamesVec
 Vector of strings of the type DistArray to store the names of the components. More...
 
std::string m_emptyComponentName
 Empty string for the components names. More...
 
V * m_zeroVector
 A vector of all elements equal to zero. More...
 
- Protected Attributes inherited from QUESO::VectorSet< V, M >
const BaseEnvironmentm_env
 
std::string m_prefix
 
double m_volume
 

Private Member Functions

 VectorSpace ()
 Default constructor. More...
 

Detailed Description

template<class V, class M>
class QUESO::VectorSpace< V, M >

A class representing a vector space.

Template classes V and M are to represent a vector class and a matrix class respectively. Currently (as of version 0.46.0) QUESO has matrix and vector classes implemented using either GSL or Trilinos-Teuchos libraries.

Definition at line 49 of file VectorSet.h.

Constructor & Destructor Documentation

template<class V , class M >
QUESO::VectorSpace< V, M >::VectorSpace ( const BaseEnvironment env,
const char *  prefix,
unsigned int  dimGlobalValue,
const std::vector< std::string > *  componentsNamesVec 
)

Shaped constructor.

Construct a vector space with QUESO environment env and of dimension dimGlobalValue.

Definition at line 38 of file VectorSpace.C.

References QUESO::BaseEnvironment::displayVerbosity(), QUESO::VectorSpace< V, M >::globalIdOfFirstComponent(), QUESO::DistArray< T >::GlobalLength(), QUESO::VectorSpace< V, M >::m_componentsNamesArray, QUESO::VectorSpace< V, M >::m_dimGlobal, QUESO::VectorSpace< V, M >::m_dimLocal, QUESO::VectorSet< V, M >::m_env, QUESO::VectorSpace< V, M >::m_map, QUESO::VectorSet< V, M >::m_prefix, QUESO::VectorSpace< V, M >::m_zeroVector, QUESO::DistArray< T >::MyLength(), QUESO::Map::NumGlobalElements(), queso_require_equal_to_msg, and QUESO::BaseEnvironment::subDisplayFile().

41  : VectorSet<V,M> (env,((std::string)(prefix) + "space_").c_str(),INFINITY),
42  m_dimGlobal(dimGlobalValue),
43  m_map(newMap()),
48  m_zeroVector(new V(m_env,*m_map))
49 {
50  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 5)) {
51  *m_env.subDisplayFile() << "Entering VectorSpace<V,M>::constructor(1)"
52  << ", with m_prefix = " << m_prefix
53  << "\n m_zeroVector->sizeGlobal() = " << m_zeroVector->sizeGlobal()
54  << "\n m_dimGlobal = " << m_dimGlobal
55  << "\n m_zeroVector->sizeLocal() = " << m_zeroVector->sizeLocal()
56  << "\n m_dimLocal = " << m_dimLocal
57  << "\n m_map->NumGlobalElements() = " << m_map->NumGlobalElements()
58  << "\n componentsNamesVec = " << componentsNamesVec
59  << std::endl;
60  }
61 
62  if (m_zeroVector->sizeGlobal() != m_dimGlobal) {
63  std::cerr << "In VectorSpace<V,M>::constructor(1)"
64  << ", with m_prefix = " << m_prefix
65  << ": m_zeroVector->sizeGlobal() = " << m_zeroVector->sizeGlobal()
66  << ", m_dimGlobal = " << m_dimGlobal
67  << std::endl;
68  }
69  queso_require_equal_to_msg(m_zeroVector->sizeGlobal(), m_dimGlobal, "global size of 'm_zeroVector' is not equal to m_dimGlobal");
70 
71  if (m_zeroVector->sizeLocal() != m_dimLocal) {
72  std::cerr << "In VectorSpace<V,M>::constructor(1)"
73  << ", with m_prefix = " << m_prefix
74  << ": m_zeroVector->sizeLocal() = " << m_zeroVector->sizeLocal()
75  << ", m_dimLocal = " << m_dimLocal
76  << std::endl;
77  }
78  queso_require_equal_to_msg(m_zeroVector->sizeLocal(), m_dimLocal, "local size of 'm_zeroVector' is not equal to m_dimLocal");
79 
80  if (componentsNamesVec != NULL) {
81  queso_require_equal_to_msg(componentsNamesVec->size(), (size_t) m_dimGlobal, "global size of 'componentsNames' is not equal to m_dimGlobal");
82 
83  m_componentsNamesArray = new DistArray<std::string>(*m_map,1);
84  unsigned int myFirstId = this->globalIdOfFirstComponent();
85  for (unsigned int i = 0; i < m_dimLocal; ++i) {
86  (*m_componentsNamesArray)(i,0) = (*componentsNamesVec)[myFirstId+i];
87  }
88 
89  queso_require_equal_to_msg(m_componentsNamesArray->GlobalLength(), (int) m_dimGlobal, "global size of 'm_componentsNamesArray' is not equal to m_dimGlobal");
90  queso_require_equal_to_msg(m_componentsNamesArray->MyLength(), (int) m_dimLocal, "local size of 'm_componentsNamesArray' is not equal to m_dimLocal");
91  }
92 
93  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 5)) {
94  *m_env.subDisplayFile() << "Leaving VectorSpace<V,M>::constructor(1)"
95  << ", with m_prefix = " << m_prefix
96  << std::endl;
97  }
98 }
unsigned int displayVerbosity() const
Definition: Environment.C:396
int GlobalLength() const
Returns the global length of the array.
Definition: DistArray.C:126
std::string m_emptyComponentName
Empty string for the components names.
Definition: VectorSpace.h:162
const std::vector< std::string > * componentsNamesVec() const
Access to private attribute m_componentsNamesVec.
unsigned int m_dimGlobal
Global dimension.
Definition: VectorSpace.h:147
DistArray< std::string > * m_componentsNamesVec
Vector of strings of the type DistArray to store the names of the components.
Definition: VectorSpace.h:159
int MyLength() const
Returns the length of the locally owned array.
Definition: DistArray.C:137
int NumMyElements() const
Returns the number of elements owned by the calling processor.
Definition: Map.C:107
const Map * m_map
Map.
Definition: VectorSpace.h:150
#define queso_require_equal_to_msg(expr1, expr2, msg)
Definition: asserts.h:85
unsigned int globalIdOfFirstComponent() const
Definition: VectorSpace.C:182
V * m_zeroVector
A vector of all elements equal to zero.
Definition: VectorSpace.h:165
const BaseEnvironment & env() const
Environment.
Definition: VectorSpace.C:151
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).
Definition: Environment.C:274
unsigned int m_dimLocal
Local dimension (number of elements owned by the calling processor.).
Definition: VectorSpace.h:153
Map * newMap()
Creates a new map. See template specialization.
std::string m_prefix
Definition: VectorSet.h:99
const std::string & prefix() const
Access to private attribute m_prefix.
Definition: VectorSet.C:84
int NumGlobalElements() const
Returns the total number of elements across all processors.
Definition: Map.C:85
DistArray< std::string > * m_componentsNamesArray
Array of strings of the type DistArray to store the names of the components.
Definition: VectorSpace.h:156
const BaseEnvironment & m_env
Definition: VectorSet.h:98
template<class V, class M>
QUESO::VectorSpace< V, M >::VectorSpace ( const VectorSpace< V, M > &  aux)

Copy constructor.

Definition at line 102 of file VectorSpace.C.

References QUESO::BaseEnvironment::displayVerbosity(), QUESO::VectorSpace< V, M >::m_componentsNamesArray, QUESO::VectorSpace< V, M >::m_componentsNamesVec, QUESO::VectorSet< V, M >::m_env, and QUESO::BaseEnvironment::subDisplayFile().

103  : VectorSet<V,M>(aux.env(),((std::string)(aux.m_prefix)).c_str(),INFINITY),
104  m_dimGlobal(aux.m_dimGlobal),
105  m_map(newMap()),
108  m_componentsNamesVec(NULL),
110  m_zeroVector(new V(m_env,*m_map))
111 {
112  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 5)) {
113  *m_env.subDisplayFile() << "Entering VectorSpace<V,M>::constructor(2)"
114  << ": aux.m_componentsNamesArray = " << aux.m_componentsNamesArray
115  << ", aux.m_componentsNamesVec = " << aux.m_componentsNamesVec
116  << std::endl;
117  }
118 
119  if (aux.m_componentsNamesArray != NULL) {
120  m_componentsNamesArray = new DistArray<std::string>(*(aux.m_componentsNamesArray));
121  }
122 
123  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 5)) {
124  *m_env.subDisplayFile() << "Leaving VectorSpace<V,M>::constructor(2)"
125  << std::endl;
126  }
127 }
unsigned int displayVerbosity() const
Definition: Environment.C:396
std::string m_emptyComponentName
Empty string for the components names.
Definition: VectorSpace.h:162
unsigned int m_dimGlobal
Global dimension.
Definition: VectorSpace.h:147
DistArray< std::string > * m_componentsNamesVec
Vector of strings of the type DistArray to store the names of the components.
Definition: VectorSpace.h:159
int NumMyElements() const
Returns the number of elements owned by the calling processor.
Definition: Map.C:107
const Map * m_map
Map.
Definition: VectorSpace.h:150
V * m_zeroVector
A vector of all elements equal to zero.
Definition: VectorSpace.h:165
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).
Definition: Environment.C:274
unsigned int m_dimLocal
Local dimension (number of elements owned by the calling processor.).
Definition: VectorSpace.h:153
Map * newMap()
Creates a new map. See template specialization.
DistArray< std::string > * m_componentsNamesArray
Array of strings of the type DistArray to store the names of the components.
Definition: VectorSpace.h:156
const BaseEnvironment & m_env
Definition: VectorSet.h:98
template<class V , class M >
QUESO::VectorSpace< V, M >::~VectorSpace ( )

Destructor.

Definition at line 131 of file VectorSpace.C.

132 {
133  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 5)) {
134  *m_env.subDisplayFile() << "Entering VectorSpace<V,M>::destructor()"
135  << std::endl;
136  }
137 
138  if (m_zeroVector != NULL) delete m_zeroVector;
139  if (m_componentsNamesVec != NULL) delete m_componentsNamesVec;
141  if (m_map != NULL) delete m_map;
142 
143  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 5)) {
144  *m_env.subDisplayFile() << "Leaving VectorSpace<V,M>::destructor()"
145  << std::endl;
146  }
147 }
unsigned int displayVerbosity() const
Definition: Environment.C:396
DistArray< std::string > * m_componentsNamesVec
Vector of strings of the type DistArray to store the names of the components.
Definition: VectorSpace.h:159
const Map * m_map
Map.
Definition: VectorSpace.h:150
V * m_zeroVector
A vector of all elements equal to zero.
Definition: VectorSpace.h:165
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).
Definition: Environment.C:274
DistArray< std::string > * m_componentsNamesArray
Array of strings of the type DistArray to store the names of the components.
Definition: VectorSpace.h:156
const BaseEnvironment & m_env
Definition: VectorSet.h:98
template<class V, class M>
QUESO::VectorSpace< V, M >::VectorSpace ( )
private

Default constructor.

Member Function Documentation

template<class V , class M >
const DistArray< std::string > * QUESO::VectorSpace< V, M >::componentsNamesArray ( ) const

Access to private attribute m_componentsNamesArray, which is an instance of DistArray.

Definition at line 265 of file VectorSpace.C.

266 {
267  return m_componentsNamesArray;
268 }
DistArray< std::string > * m_componentsNamesArray
Array of strings of the type DistArray to store the names of the components.
Definition: VectorSpace.h:156
template<class V, class M>
const std::vector<std::string>* QUESO::VectorSpace< V, M >::componentsNamesVec ( ) const

Access to private attribute m_componentsNamesVec.

template<class V, class M >
bool QUESO::VectorSpace< V, M >::contains ( const V &  vec) const
virtual

Whether vector contains vector vec.

Implements QUESO::VectorSet< V, M >.

Definition at line 258 of file VectorSpace.C.

259 {
260  if (vec[0]) {}; // just to remove compiler warning
261  return true;
262 }
template<class V , class M >
unsigned int QUESO::VectorSpace< V, M >::dimGlobal ( ) const
template<class V , class M >
unsigned int QUESO::VectorSpace< V, M >::dimLocal ( ) const
template<class V , class M >
const BaseEnvironment & QUESO::VectorSpace< V, M >::env ( ) const

Environment.

Definition at line 151 of file VectorSpace.C.

Referenced by QUESO::InstantiateIntersection().

152 {
153  return m_env;
154 }
const BaseEnvironment & m_env
Definition: VectorSet.h:98
template<class V , class M >
unsigned int QUESO::VectorSpace< V, M >::globalIdOfFirstComponent ( ) const

Definition at line 182 of file VectorSpace.C.

Referenced by QUESO::VectorSpace< V, M >::VectorSpace().

183 {
184  return m_map->MinMyGID();
185 }
const Map * m_map
Map.
Definition: VectorSpace.h:150
int MinMyGID() const
The minimum global index value on the calling processor.
Definition: Map.C:118
template<class V , class M >
const std::string & QUESO::VectorSpace< V, M >::localComponentName ( unsigned int  localComponentId) const

Returns the local component names.

Definition at line 271 of file VectorSpace.C.

References queso_require_less_equal_msg.

273 {
274  if (m_componentsNamesArray == NULL) return m_emptyComponentName;
275 
276  queso_require_less_equal_msg(localComponentId, m_dimLocal, "localComponentId is too big");
277 
278 //return (*(const_cast<DistArray<std::string>*>(m_componentsNamesArray)))(localComponentId,0);
279  return (*m_componentsNamesArray)(localComponentId,0);
280 }
std::string m_emptyComponentName
Empty string for the components names.
Definition: VectorSpace.h:162
#define queso_require_less_equal_msg(expr1, expr2, msg)
Definition: asserts.h:89
unsigned int m_dimLocal
Local dimension (number of elements owned by the calling processor.).
Definition: VectorSpace.h:153
DistArray< std::string > * m_componentsNamesArray
Array of strings of the type DistArray to store the names of the components.
Definition: VectorSpace.h:156
template<class V , class M >
const Map & QUESO::VectorSpace< V, M >::map ( ) const
template<>
GslMatrix * QUESO::VectorSpace< GslVector, GslMatrix >::newDiagMatrix ( double  diagValue) const

Definition at line 60 of file GslVectorSpace.C.

61 {
62  return new GslMatrix(m_env,*m_map,diagValue);
63 }
const Map * m_map
Map.
Definition: VectorSpace.h:150
const BaseEnvironment & m_env
Definition: VectorSet.h:98
template<class V, class M >
M * QUESO::VectorSpace< V, M >::newDiagMatrix ( const V &  v) const

Creates a diagonal matrix with the elements and size of vector v.

Definition at line 205 of file VectorSpace.C.

206 {
207  if (v.sizeGlobal() != m_dimGlobal) return NULL;
208  if (v.sizeLocal () != m_dimLocal ) return NULL;
209 
210  return new M(v);
211 }
unsigned int m_dimGlobal
Global dimension.
Definition: VectorSpace.h:147
unsigned int m_dimLocal
Local dimension (number of elements owned by the calling processor.).
Definition: VectorSpace.h:153
template<class V, class M>
M* QUESO::VectorSpace< V, M >::newDiagMatrix ( double  diagValue) const

Creates a diagonal matrix with the elements diagValue and size given by Map& map. See template specialization.

template<>
Map * QUESO::VectorSpace< GslVector, GslMatrix >::newMap ( )
protected

Definition at line 32 of file GslVectorSpace.C.

33 {
34  return new Map(m_dimGlobal,0,m_env.selfComm());
35 }
unsigned int m_dimGlobal
Global dimension.
Definition: VectorSpace.h:147
const MpiComm & selfComm() const
Access function for MpiComm self-communicator.
Definition: Environment.C:254
const BaseEnvironment & m_env
Definition: VectorSet.h:98
template<class V, class M>
Map* QUESO::VectorSpace< V, M >::newMap ( )
protected

Creates a new map. See template specialization.

template<>
GslMatrix * QUESO::VectorSpace< GslVector, GslMatrix >::newMatrix ( ) const

Definition at line 53 of file GslVectorSpace.C.

54 {
55  return new GslMatrix(m_env,*m_map,this->dimGlobal());
56 }
const Map * m_map
Map.
Definition: VectorSpace.h:150
unsigned int dimGlobal() const
Definition: VectorSpace.C:176
const BaseEnvironment & m_env
Definition: VectorSet.h:98
template<class V, class M>
M* QUESO::VectorSpace< V, M >::newMatrix ( ) const

Creates an empty matrix of size given by Map& map. See template specialization.

template<class V, class M >
M * QUESO::VectorSpace< V, M >::newProposalMatrix ( const V *  varVec,
const V *  auxVec 
) const

Creates a diagonal matrix conditionally to values from vector varVec, guaranteeing that its values are neither 0, NAN nor INFINITY.

If varVec[i] is either 0, NAN or INFINITY, then this method tries to assign the value (*auxVec)[i])^2 to matrix(i,i). Case (*auxVec)[i])^2 is either NAN or INFINITY, then matrix(i,i)=1.

Definition at line 214 of file VectorSpace.C.

215 {
216  V tmpVec(*m_zeroVector);
217  for (unsigned int i = 0; i < m_dimLocal; ++i) {
218  double variance = INFINITY;
219  if (varVec) variance = (*varVec)[i];
220  if (m_env.subDisplayFile()) {
221  *m_env.subDisplayFile() << "In VectorSpace<V,M>::newProposalMatrix()"
222  << ": i = " << i
223  << ", variance = " << variance
224  << std::endl;
225  }
226  if ((variance == INFINITY) ||
227  (variance == NAN )) {
228  if (auxVec) {
229  tmpVec[i] = std::pow( fabs((*auxVec)[i])*0.05,2. );
230  if ((tmpVec[i] == 0. ) ||
231  (tmpVec[i] == INFINITY) ||
232  (tmpVec[i] == NAN )) {
233  tmpVec[i] = 1.;
234  }
235  }
236  else {
237  tmpVec[i] = 1.;
238  }
239  }
240  else if (variance == 0.) {
241  tmpVec[i] = 1.;
242  }
243  else {
244  tmpVec[i] = variance;
245  }
246  }
247 
248  return newDiagMatrix(tmpVec);
249 }
V * m_zeroVector
A vector of all elements equal to zero.
Definition: VectorSpace.h:165
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).
Definition: Environment.C:274
M * newDiagMatrix(const V &v) const
Creates a diagonal matrix with the elements and size of vector v.
Definition: VectorSpace.C:205
unsigned int m_dimLocal
Local dimension (number of elements owned by the calling processor.).
Definition: VectorSpace.h:153
const BaseEnvironment & m_env
Definition: VectorSet.h:98
template<>
GslVector * QUESO::VectorSpace< GslVector, GslMatrix >::newVector ( ) const

Definition at line 39 of file GslVectorSpace.C.

40 {
41  return new GslVector(m_env,*m_map);
42 }
const Map * m_map
Map.
Definition: VectorSpace.h:150
const BaseEnvironment & m_env
Definition: VectorSet.h:98
template<>
GslVector * QUESO::VectorSpace< GslVector, GslMatrix >::newVector ( double  value) const

Definition at line 46 of file GslVectorSpace.C.

47 {
48  return new GslVector(m_env,*m_map,value);
49 }
const Map * m_map
Map.
Definition: VectorSpace.h:150
const BaseEnvironment & m_env
Definition: VectorSet.h:98
template<class V, class M>
V* QUESO::VectorSpace< V, M >::newVector ( ) const

Creates an empty vector of size given by Map& map. See template specialization.

template<class V, class M>
V* QUESO::VectorSpace< V, M >::newVector ( double  value) const

Creates a vector of size given by Map& map and all values give by value. See template specialization.

template<class V, class M >
V * QUESO::VectorSpace< V, M >::newVector ( const V &  v) const

Creates vector as a copy of another.

Definition at line 196 of file VectorSpace.C.

197 {
198  if (v.sizeGlobal() != m_dimGlobal) return NULL;
199  if (v.sizeLocal () != m_dimLocal ) return NULL;
200 
201  return new V(v);
202 }
unsigned int m_dimGlobal
Global dimension.
Definition: VectorSpace.h:147
unsigned int m_dimLocal
Local dimension (number of elements owned by the calling processor.).
Definition: VectorSpace.h:153
template<class V , class M >
unsigned int QUESO::VectorSpace< V, M >::numOfProcsForStorage ( ) const

Returns total number of processes.

Definition at line 164 of file VectorSpace.C.

Referenced by QUESO::ComputeCovCorrMatricesBetweenVectorRvs(), and QUESO::ComputeCovCorrMatricesBetweenVectorSequences().

165 {
166  return m_map->Comm().NumProc();
167 }
const MpiComm & Comm() const
Access function for MpiComm communicator.
Definition: Map.C:131
int NumProc() const
Returns total number of processes.
Definition: MpiComm.C:103
const Map * m_map
Map.
Definition: VectorSpace.h:150
template<class V , class M >
void QUESO::VectorSpace< V, M >::print ( std::ostream &  os) const
virtual

Prints only a message.

Reimplemented from QUESO::VectorSet< V, M >.

Definition at line 303 of file VectorSpace.C.

304 {
305  os << "In VectorSpace<V,M>::print()"
306  << ": nothing to be printed" << std::endl;
307  return;
308 }
template<class V , class M >
void QUESO::VectorSpace< V, M >::printComponentsNames ( std::ostream &  os,
bool  printHorizontally 
) const

Prints the local component names.

Definition at line 283 of file VectorSpace.C.

285 {
286  if (printHorizontally) {
287  for (unsigned int i = 0; i < this->dimLocal(); ++i) {
288  os << "'" << this->localComponentName(i) << "'"
289  << " ";
290  }
291  }
292  else {
293  for (unsigned int i = 0; i < this->dimLocal(); ++i) {
294  os << "'" << this->localComponentName(i) << "'"
295  << std::endl;
296  }
297  }
298 
299  return;
300 }
unsigned int dimLocal() const
Definition: VectorSpace.C:170
const std::string & localComponentName(unsigned int localComponentId) const
Returns the local component names.
Definition: VectorSpace.C:271
template<class V , class M >
const VectorSpace< V, M > & QUESO::VectorSpace< V, M >::vectorSpace ( ) const
virtual

Accessor method to this. Vector space to which this vector set belongs to.

It is virtual in the base class 'VectorSet'

Implements QUESO::VectorSet< V, M >.

Definition at line 252 of file VectorSpace.C.

253 {
254  return *this;
255 }
template<class V , class M >
const V & QUESO::VectorSpace< V, M >::zeroVector ( ) const

Member Data Documentation

template<class V, class M>
DistArray<std::string>* QUESO::VectorSpace< V, M >::m_componentsNamesArray
protected

Array of strings of the type DistArray to store the names of the components.

Definition at line 156 of file VectorSpace.h.

Referenced by QUESO::VectorSpace< V, M >::VectorSpace().

template<class V, class M>
DistArray<std::string>* QUESO::VectorSpace< V, M >::m_componentsNamesVec
protected

Vector of strings of the type DistArray to store the names of the components.

Definition at line 159 of file VectorSpace.h.

Referenced by QUESO::VectorSpace< V, M >::VectorSpace().

template<class V, class M>
unsigned int QUESO::VectorSpace< V, M >::m_dimGlobal
protected

Global dimension.

Definition at line 147 of file VectorSpace.h.

Referenced by QUESO::VectorSpace< V, M >::VectorSpace().

template<class V, class M>
unsigned int QUESO::VectorSpace< V, M >::m_dimLocal
protected

Local dimension (number of elements owned by the calling processor.).

Definition at line 153 of file VectorSpace.h.

Referenced by QUESO::VectorSpace< V, M >::VectorSpace().

template<class V, class M>
std::string QUESO::VectorSpace< V, M >::m_emptyComponentName
protected

Empty string for the components names.

Definition at line 162 of file VectorSpace.h.

template<class V, class M>
const Map* QUESO::VectorSpace< V, M >::m_map
protected

Map.

Definition at line 150 of file VectorSpace.h.

Referenced by QUESO::VectorSpace< V, M >::VectorSpace().

template<class V, class M>
V* QUESO::VectorSpace< V, M >::m_zeroVector
protected

A vector of all elements equal to zero.

Definition at line 165 of file VectorSpace.h.

Referenced by QUESO::VectorSpace< V, M >::VectorSpace().


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

Generated on Thu Jun 11 2015 13:52:34 for queso-0.53.0 by  doxygen 1.8.5