9 #ifndef _fei_Vector_Impl_hpp_
10 #define _fei_Vector_Impl_hpp_
30 #define fei_file "fei_Vector_Impl.hpp"
62 T* vector,
int numLocalEqns,
63 bool isSolutionVector=
false,
64 bool deleteVector=
false);
101 int sumIn(
int numValues,
const int* indices,
const double* values,
107 int copyIn(
int numValues,
const int* indices,
const double* values,
169 bool matrixMarketFormat=
true);
172 bool matrixMarketFormat=
true);
191 int vectorIndex=0)
const;
195 int copyOut_FE(
int nodeNumber,
int dofOffset,
double& value);
200 const double* values,
207 int vectorIndex=0)
const;
212 const int* nodeNumbers,
213 const int* numIndicesPerNode,
215 const double* values);
231 T* vector,
int numLocalEqns,
232 bool isSolutionVector,
236 isSolution_(isSolutionVector),
237 deleteVector_(deleteVector),
240 dbgprefix_(
"VecImpl: ")
254 os <<
dbgprefix_<<
" ctor, numLocalEqns="<<numLocalEqns
258 std::vector<int> idTypes;
260 std::vector<int> eqns;
261 std::vector<double> zeros;
262 for(
size_t i=0; i<idTypes.size(); ++i) {
263 int idType = idTypes[i];
267 iter = idMap.begin(), iterEnd = idMap.end();
268 for(; iter!=iterEnd; ++iter) {
269 int ID = iter->first;
274 zeros.resize(ndof, 0.0);
275 for(
int j=0; j<ndof; ++j) eqns[j] = eqn+j;
276 if (!isSolutionVector) {
277 sumIn(ndof, &eqns[0], &zeros[0]);
280 copyIn(ndof, &eqns[0], &zeros[0]);
287 for(
size_t i=0; i<remoteVecs.size(); ++i) {
288 remoteVecs[i]->clear();
296 if (deleteVector_)
delete vector_;
305 os << dbgprefix_<<
"putScalar("<<scalar<<
")"<<
FEI_ENDL;
308 if (haveFEVector()) {
309 if (scalar != 0.0)
return(-1);
315 for(
unsigned p=0; p<remotelyOwned().size(); ++p) {
343 os << dbgprefix_<<
"scatterToOverlap"<<
FEI_ENDL;
355 os << dbgprefix_<<
"setCommSizes"<<
FEI_ENDL;
367 os << dbgprefix_<<
"gatherFromOverlap"<<
FEI_ENDL;
376 const int* indices,
const double* values,
381 os << dbgprefix_<<
"sumIn(n="<<numValues<<
")"<<
FEI_ENDL;
384 return( giveToVector(numValues, indices, values,
true, vectorIndex) );
390 const int* indices,
const double* values,
395 os << dbgprefix_<<
"copyIn(n="<<numValues<<
")"<<
FEI_ENDL;
398 return( giveToVector(numValues, indices, values,
false, vectorIndex) );
405 const double* values,
411 os << dbgprefix_<<
"giveToUnderlying(";
412 for(
int i=0; i<numValues; ++i) {
413 os <<
"{"<<indices[i]<<
","<<values[i]<<
"} ";
419 numValues, indices, values,
420 sumInto, isSolution_, vectorIndex);
432 int vectorIndex)
const
436 os << dbgprefix_<<
"copyOutOfUnderlying(n="<<numValues<<
")"<<
FEI_ENDL;
440 numValues, indices, values,
441 isSolution_, vectorIndex) );
455 os << dbgprefix_<<
"sumInFieldData(n="<<numIDs<<
")"<<
FEI_ENDL;
458 return( assembleFieldData(fieldID, idType, numIDs, IDs, data,
true, vectorIndex));
472 os << dbgprefix_<<
"copyInFieldData(n="<<numIDs<<
")"<<
FEI_ENDL;
475 return(assembleFieldData(fieldID, idType, numIDs, IDs, data,
false, vectorIndex));
489 os << dbgprefix_<<
"copyInFieldDataLocalIDs(n="<<numIDs<<
")"<<
FEI_ENDL;
492 return(assembleFieldDataLocalIDs(fieldID, idType, numIDs, localIDs, data,
false, vectorIndex));
518 bool matrixMarketFormat)
526 bool matrixMarketFormat)
536 int vectorIndex)
const
540 os << dbgprefix_<<
"copyOut(n="<<numValues<<
")"<<
FEI_ENDL;
551 const int* nodeNumbers,
552 const int* numIndicesPerNode,
554 const double* values)
557 numNodes, nodeNumbers,
558 numIndicesPerNode, dof_ids, values) );
562 #define fei_file "unknown_file"
564 #endif // _fei_Vector_Impl_hpp_
MPI_Comm getCommunicator() const
static int putValuesIn(T *vec, int firstLocalOffset, int numValues, const int *indices, const double *values, bool sum_into, bool isSolnVector=false, int vectorIndex=0)
std::map< T, std::set< int > > map_type
map_type & getSharedIDs()
fei::SharedPtr< fei::VectorSpace > getVectorSpace() const
int writeToStream(FEI_OSTREAM &ostrm, bool matrixMarketFormat=true)
int sumInFieldData(int fieldID, int idType, int numIDs, const int *IDs, const double *data, int vectorIndex=0)
void set_values(CSVec &vec, double scalar)
int copyOut(int numValues, const int *indices, double *values, int vectorIndex=0) const
virtual int writeToStream(FEI_OSTREAM &ostrm, bool matrixMarketFormat=true)
int copyOut(int numValues, const int *indices, double *values, int vectorIndex=0) const
void set_vector_space(fei::SharedPtr< fei::VectorSpace > vspace)
int copyOutOfUnderlyingVector(int numValues, const int *indices, double *values, int vectorIndex=0) const
int getGlobalIndex(int idType, int ID, int fieldID, int fieldOffset, int whichComponentOfField, int &globalIndex)
int copyOutFieldData(int fieldID, int idType, int numIDs, const int *IDs, double *data, int vectorIndex=0)
void getIDTypes(std::vector< int > &idTypes) const
std::vector< CSVec * > & remotelyOwned()
int putScalar(double scalar)
void setFEVector(bool flag)
int sumIntoFEVector(int blockID, int connOffset, int numNodes, const int *nodeNumbers, const int *numIndicesPerNode, const int *dof_ids, const double *values)
const T * getUnderlyingVector() const
virtual int copyOutFieldData(int fieldID, int idType, int numIDs, const int *IDs, double *data, int vectorIndex=0)
int copyIn(int numValues, const int *indices, const double *values, int vectorIndex=0)
OutputLevel output_level_
fei::SharedIDs< int > & getSharedIDs(int idType)
const char * typeName() const
int update(double a, const fei::Vector *x, double b)
int copyInFieldData(int fieldID, int idType, int numIDs, const int *IDs, const double *data, int vectorIndex=0)
FEI_OSTREAM * output_stream_
fei::SharedPtr< fei::VectorSpace > get_vector_space() const
int copyInFieldDataLocalIDs(int fieldID, int idType, int numIDs, const int *localIDs, const double *data, int vectorIndex=0)
T * getUnderlyingVector()
int localProc(MPI_Comm comm)
int gatherFromOverlap(bool accumulate=true)
int writeToFile(const char *filename, bool matrixMarketFormat=true)
virtual int writeToFile(const char *filename, bool matrixMarketFormat=true)
void setUnderlyingVector(T *vec)
int sumIn(int numValues, const int *indices, const double *values, int vectorIndex=0)
virtual int scatterToOverlap()
int getNumDegreesOfFreedom(int idType, int ID)
int giveToUnderlyingVector(int numValues, const int *indices, const double *values, bool sumInto=true, int vectorIndex=0)
void setVectorSpace(fei::SharedPtr< fei::VectorSpace > vecSpace)
virtual int gatherFromOverlap(bool accumulate=true)
int numProcs(MPI_Comm comm)
int copyOut_FE(int nodeNumber, int dofOffset, double &value)
Vector_Impl(fei::SharedPtr< fei::VectorSpace > vecSpace, T *vector, int numLocalEqns, bool isSolutionVector=false, bool deleteVector=false)