60 bool ignoreNonLocalEntries)
64 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
67 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
70 nonlocalElementSize_(),
75 ignoreNonLocalEntries_(ignoreNonLocalEntries)
84 double *
A,
int MyLDA,
int theNumVectors,
85 bool ignoreNonLocalEntries)
89 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
92 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
95 nonlocalElementSize_(),
100 ignoreNonLocalEntries_(ignoreNonLocalEntries)
109 double **ArrayOfPointers,
int theNumVectors,
110 bool ignoreNonLocalEntries)
114 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
117 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
120 nonlocalElementSize_(),
125 ignoreNonLocalEntries_(ignoreNonLocalEntries)
137 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
140 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
143 nonlocalElementSize_(),
148 ignoreNonLocalEntries_(source.ignoreNonLocalEntries_)
163 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES 165 const double* values,
168 return(
inputValues( numIDs, GIDs, values,
true, vectorIndex) );
171 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES 173 const double* values,
176 return(
inputValues( numIDs, GIDs, values,
true, vectorIndex) );
180 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES 193 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES 207 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES 209 const int* numValuesPerID,
210 const double* values,
213 return(
inputValues( numIDs, GIDs, numValuesPerID, values,
true,
217 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES 219 const int* numValuesPerID,
220 const double* values,
223 return(
inputValues( numIDs, GIDs, numValuesPerID, values,
true,
228 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES 230 const double* values,
237 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES 239 const double* values,
247 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES 260 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES 274 template<
typename int_type>
276 const int_type* GIDs,
277 const double* values,
285 for(
int i=0; i<numIDs; ++i) {
286 if (
Map().MyGID(GIDs[i])) {
306 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES 308 const int* numValuesPerID,
309 const double* values,
312 return(
inputValues( numIDs, GIDs, numValuesPerID, values,
false,
316 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES 318 const int* numValuesPerID,
319 const double* values,
322 return(
inputValues( numIDs, GIDs, numValuesPerID, values,
false,
327 template<
typename int_type>
329 const int_type* GIDs,
330 const int* numValuesPerID,
331 const double* values,
335 if(!
Map().
template GlobalIndicesIsType<int_type>())
336 throw ReportError(
"Epetra_FEVector::inputValues mismatch between argument types (int/long long) and map type.", -1);
339 for(
int i=0; i<numIDs; ++i) {
340 int numValues = numValuesPerID[i];
341 if (
Map().MyGID(GIDs[i])) {
343 for(
int j=0; j<numValues; ++j) {
348 for(
int j=0; j<numValues; ++j) {
356 &(values[offset]), suminto,
367 template<
typename int_type>
375 template<
typename int_type>
377 const double* values,
bool suminto,
380 if(!
Map().
template GlobalIndicesIsType<int_type>())
381 throw ReportError(
"Epetra_FEVector::inputValues mismatch between argument types (int/long long) and map type.", -1);
386 std::vector<int_type>& nonlocalIDs_var = nonlocalIDs<int_type>();
388 typename std::vector<int_type>::iterator it = std::lower_bound(nonlocalIDs_var.begin(), nonlocalIDs_var.end(), GID);
389 int offset = (int) (it - nonlocalIDs_var.begin());
390 int insertPoint = offset;
391 if (it == nonlocalIDs_var.end() || *it != GID) {
401 std::cerr <<
"Epetra_FEVector ERROR: block-size for GID " << GID <<
" is " 402 << numValues<<
" which doesn't match previously set block-size of " 407 offset = offset*elemSize;
410 for(
int j=0; j<numValues; ++j) {
415 for(
int j=0; j<numValues; ++j) {
426 nonlocalIDs_var.insert(it, GID);
433 for(
int ii=0; ii<elemSize; ++ii) {
438 for(
int j=0; j<numValues; ++j) {
447 template<
typename int_type>
449 bool reuse_map_and_exporter)
462 createNonlocalMapAndExporter<int_type>();
470 for(
size_t i=0; i<nonlocalIDs<int_type>().size(); ++i) {
480 if (reuse_map_and_exporter) {
481 zeroNonlocalData<int_type>();
491 bool reuse_map_and_exporter)
493 if(
Map().GlobalIndicesInt())
494 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES 495 return GlobalAssemble<int>(mode, reuse_map_and_exporter);
497 throw ReportError(
"Epetra_FEVector::GlobalAssemble: ERROR, GlobalIndicesInt but no API for it.",-1);
500 if(
Map().GlobalIndicesLongLong())
501 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES 502 return GlobalAssemble<long long>(mode, reuse_map_and_exporter);
504 throw ReportError(
"Epetra_FEVector::GlobalAssemble: ERROR, GlobalIndicesLongLong but no API for it.",-1);
507 throw ReportError(
"Epetra_FEVector::GlobalAssemble: Internal error, unable to determine global index type of maps", -1);
510 template<
typename int_type>
513 std::vector<int_type>& nonlocalIDs_var = nonlocalIDs<int_type>();
537 if (
this == &source) {
547 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES 550 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES 560 template<
typename int_type>
563 if (nonlocalIDs<int_type>().size() > 0) {
566 for(
size_t i=0; i<nonlocalIDs<int_type>().size(); ++i) {
568 for(
int j=0; j<elemSize; ++j) {
579 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES 582 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES Epetra_MultiVector: A class for constructing and using dense multi-vectors, vectors and matrices in p...
const Epetra_BlockMap & Map() const
Returns the address of the Epetra_BlockMap for this multi-vector.
std::vector< int > nonlocalIDs_int_
Epetra_IntSerialDenseVector: A class for constructing and using dense vectors.
std::vector< long long > nonlocalIDs_LL_
long long MinMyGID64() const
long long * Values()
Returns pointer to the values in vector.
std::vector< std::vector< double > > nonlocalCoefs_
Array of arrays (one per column) of nonlocal coefficients.
int PutScalar(double ScalarConstant)
Initialize all values in a multi-vector with constant value.
double * Values() const
Returns pointer to the values in vector.
T * Epetra_Util_data_ptr(std::vector< T > &vec)
Function that returns either a pointer to the first entry in the vector or, if the vector is empty...
#define EPETRA_CHK_ERR(a)
Epetra_BlockMap * nonlocalMap_
Map describing distribution of nonlocal data.
Epetra_Export: This class builds an export object for efficient exporting of off-processor elements...
int Length() const
Returns length of vector.
virtual int ReportError(const std::string Message, int ErrorCode) const
Error reporting method.
Epetra_MultiVector(const Epetra_BlockMap &Map, int NumVectors, bool zeroOut=true)
Basic Epetra_MultiVector constuctor.
void createNonlocalMapAndExporter()
Allocate the Map, Export object, and MultiVector for nonlocal data.
int Length() const
Returns length of vector.
int inputNonlocalValue(int_type GID, double value, bool suminto, int vectorIndex)
const Epetra_Comm & Comm() const
Returns the address of the Epetra_Comm for this multi-vector.
int SumIntoGlobalValue(int GlobalRow, int VectorIndex, double ScalarValue)
Adds ScalarValue to existing value at the specified (GlobalRow, VectorIndex) location.
Epetra_SerialDenseVector: A class for constructing and using dense vectors.
int inputValues(int numIDs, const int_type *GIDs, const double *values, bool suminto, int vectorIndex)
std::vector< int > nonlocalElementSize_
int Export(const Epetra_SrcDistObject &A, const Epetra_Import &Importer, Epetra_CombineMode CombineMode, const Epetra_OffsetIndex *Indexor=0)
Exports an Epetra_DistObject using the Epetra_Import object.
void destroyNonlocalData()
Deallocate storage for nonlocal data.
Epetra_FEVector(const Epetra_BlockMap &Map, int numVectors=1, bool ignoreNonLocalEntries=false)
Constructor that requires a map specifying a non-overlapping data layout.
int NumVectors() const
Returns the number of vectors in the multi-vector.
int NumMyElements() const
Number of elements on the calling processor.
int ReplaceGlobalValue(int GlobalRow, int VectorIndex, double ScalarValue)
Replace current value at the specified (GlobalRow, VectorIndex) location with ScalarValue.
virtual ~Epetra_FEVector()
Destructor.
Epetra_BlockMap: A class for partitioning block element vectors and matrices.
Epetra_LongLongSerialDenseVector: A class for constructing and using dense vectors.
const Epetra_Comm & Comm() const
Access function for Epetra_Comm communicator.
int inputNonlocalValues(int_type GID, int numValues, const double *values, bool suminto, int vectorIndex)
void destroyNonlocalMapAndExporter()
Deallocate the Map, Export object, and MultiVector for nonlocal data.
Epetra_MultiVector * nonlocalVector_
Multivector that holds nonlocal data; source for the Export operation.
long long IndexBase64() const
int ReplaceGlobalValues(int numIDs, const int *GIDs, const double *values, int vectorIndex=0)
Copy values into the vector overwriting any values that already exist for the specified indices...
int GlobalAssemble(Epetra_CombineMode mode=Add, bool reuse_map_and_exporter=false)
Gather any overlapping/shared data into the non-overlapping partitioning defined by the Map that was ...
Epetra Finite-Element Vector.
void Assign(const Epetra_MultiVector &rhs)
int MaxElementSize() const
Maximum element size across all processors.
int Length() const
Returns length of vector.
bool ignoreNonLocalEntries_
void zeroNonlocalData()
Make all the nonlocal multivector entries zero.
int * Values()
Returns pointer to the values in vector.
Epetra_FEVector & operator=(const Epetra_FEVector &source)
Epetra_Export * exporter_
Export object that sums nonlocal data into a nonoverlapping distribution.
int SumIntoGlobalValues(int numIDs, const int *GIDs, const double *values, int vectorIndex=0)
Accumulate values into the vector, adding them to any values that already exist for the specified ind...