17 #define fei_file "fei_Vector_Local.cpp"
22 : vecSpace_(vecSpace),
30 std::vector<int> indices;
33 std::sort(indices.begin(), indices.end());
35 for(
int i=0; i<numCoefs; ++i) {
64 { (void)accumulate;
return(0); }
69 for(
size_t i=0; i<
coefs_.size(); ++i)
coefs_[i] = scalar;
76 bool sumInto,
int vectorIndex)
78 if (vectorIndex != 0) {
83 for(
int i=0; i<numValues; ++i) {
84 std::map<int,int>::iterator
87 fei::console_out() <<
"fei::Vector_Local ERROR, eqn "<<indices[i]<<
" not found "
93 coefs_[iter->second] += values[i];
96 coefs_[iter->second] = values[i];
107 return(
giveToVector(numValues, indices, values,
true, vectorIndex) );
114 return(
giveToVector(numValues, indices, values,
false, vectorIndex) );
178 data,
true, vectorIndex));
190 data,
false, vectorIndex));
202 data,
false, vectorIndex));
222 std::map<int,int>::iterator
230 data[i] =
coefs_[iter->second];
238 double* values,
int vectorIndex)
const
240 if (vectorIndex != 0) {
245 for(
int i=0; i<numValues; ++i) {
246 std::map<int,int>::const_iterator
249 fei::console_out() <<
"fei::Vector_Local::copyOut ERROR, eqn "<<indices[i]<<
" not found "
254 values[i] =
coefs_[iter->second];
268 bool matrixMarketFormat)
272 osstr << filename <<
"." << local_proc;
273 std::string fullname = osstr.str();
281 bool matrixMarketFormat)
283 static char mmbanner[] =
"%%MatrixMarket matrix array real general";
285 if (matrixMarketFormat) {
296 std::map<int,int>::iterator
299 for(
unsigned i=0; i<
coefs_.size(); ++i) {
300 if (matrixMarketFormat) {
int copyOutFieldData(int fieldID, int idType, int numIDs, const int *IDs, double *data, int vectorIndex=0)
MPI_Comm getCommunicator() const
int getGlobalIndicesLocalIDs(int numIDs, const int *localIDs, int idType, int fieldID, int *globalIndices)
int copyInFieldDataLocalIDs(int fieldID, int idType, int numIDs, const int *localIDs, const double *data, int vectorIndex=0)
void setVectorSpace(fei::SharedPtr< fei::VectorSpace > vecSpace)
int assembleFieldDataLocalIDs(int fieldID, int idType, int numIDs, const int *localIDs, const double *data, bool sumInto, int vectorIndex)
int gatherFromOverlap(bool accumulate=true)
int getIndices_SharedAndOwned(std::vector< int > &globalIndices) const
int giveToVector(int numValues, const int *indices, const double *values, bool sumInto, int vectorIndex)
fei::SharedPtr< fei::VectorSpace > vecSpace_
int copyIn(int numValues, const int *indices, const double *values, int vectorIndex=0)
int update(double a, const fei::Vector *x, double b)
int putScalar(double scalar)
int copyInFieldData(int fieldID, int idType, int numIDs, const int *IDs, const double *data, int vectorIndex=0)
int writeToStream(FEI_OSTREAM &ostrm, bool matrixMarketFormat=true)
std::map< int, int > global_to_local_
Vector_Local(fei::SharedPtr< fei::VectorSpace > vecSpace)
std::vector< double > coefs_
std::vector< double > & getCoefs()
int getGlobalIndices(int numIDs, const int *IDs, int idType, int fieldID, int *globalIndices)
int writeToFile(const char *filename, bool matrixMarketFormat=true)
int sumIn(int numValues, const int *indices, const double *values, int vectorIndex=0)
fei::SharedPtr< fei::VectorSpace > getVectorSpace() const
std::vector< int > work_indices_
int assembleFieldData(int fieldID, int idType, int numIDs, const int *IDs, const double *data, bool sumInto, int vectorIndex)
int copyOut(int numValues, const int *indices, double *values, int vectorIndex=0) const
std::ostream & console_out()
int sumInFieldData(int fieldID, int idType, int numIDs, const int *IDs, const double *data, int vectorIndex=0)
int localProc(MPI_Comm comm)
int getNumIndices_SharedAndOwned() const
unsigned getFieldSize(int fieldID)
#define FEI_OSTRINGSTREAM