Skip to content

Commit

Permalink
Construct GlobalBasisMatrix_ with row map.
Browse files Browse the repository at this point in the history
  • Loading branch information
searhein committed Mar 2, 2021
1 parent 3b2b766 commit ec61cfc
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -171,25 +171,45 @@ namespace FROSch {
FROSCH_ASSERT(!AssembledBasisMap_.is_null(),"FROSch::CoarseSpace: AssembledBasisMap_.is_null().");
FROSCH_ASSERT(!AssembledBasis_.is_null(),"FROSch::CoarseSpace: AssembledBasis_.is_null().");

GlobalBasisMatrix_ = MatrixFactory<SC,LO,GO,NO>::Build(rowMap,AssembledBasisMap_->getNodeNumElements()); // Nonzeroes abhängig von dim/dofs!!!

LO iD;
SC valueTmp;

for (UN i=0; i<AssembledBasis_->getLocalLength(); i++) {
GOVec indices;
SCVec values;
for (UN j=0; j<AssembledBasis_->getNumVectors(); j++) {
valueTmp=AssembledBasis_->getData(j)[i];
if (fabs(valueTmp)>treshold) {
indices.push_back(AssembledBasisMap_->getGlobalElement(j));
values.push_back(valueTmp);
if (rowMap->lib()==UseEpetra) {
GlobalBasisMatrix_ = MatrixFactory<SC,LO,GO,NO>::Build(rowMap,AssembledBasisMap_->getNodeNumElements()); // Nonzeroes abhängig von dim/dofs!!!
LO iD;
SC valueTmp;
for (UN i=0; i<AssembledBasis_->getLocalLength(); i++) {
GOVec indices;
SCVec values;
for (UN j=0; j<AssembledBasis_->getNumVectors(); j++) {
valueTmp=AssembledBasis_->getData(j)[i];
if (fabs(valueTmp)>treshold) {
indices.push_back(AssembledBasisMap_->getGlobalElement(j));
values.push_back(valueTmp);
}
}
iD = repeatedMap->getGlobalElement(i);

if (rowMap->getLocalElement(iD)!=-1) { // This should prevent duplicate entries on the interface
GlobalBasisMatrix_->insertGlobalValues(iD,indices(),values());
}
}
iD = repeatedMap->getGlobalElement(i);
} else {
GlobalBasisMatrix_ = MatrixFactory<SC,LO,GO,NO>::Build(rowMap,AssembledBasisMap_,AssembledBasisMap_->getNodeNumElements()); // Nonzeroes abhängig von dim/dofs!!!
LO iD;
SC valueTmp;
for (UN i=0; i<AssembledBasis_->getLocalLength(); i++) {
LOVec indices;
SCVec values;
for (UN j=0; j<AssembledBasis_->getNumVectors(); j++) {
valueTmp=AssembledBasis_->getData(j)[i];
if (fabs(valueTmp)>treshold) {
indices.push_back(j);
values.push_back(valueTmp);
}
}
iD = rowMap->getLocalElement(repeatedMap->getGlobalElement(i));

if (rowMap->getLocalElement(iD)!=-1) { // This should prevent duplicate entries on the interface
GlobalBasisMatrix_->insertGlobalValues(iD,indices(),values());
if (iD!=-1) { // This should prevent duplicate entries on the interface
GlobalBasisMatrix_->insertLocalValues(iD,indices(),values());
}
}
}
GlobalBasisMatrix_->fillComplete(AssembledBasisMapUnique_,rangeMap); //RCP<FancyOStream> fancy = fancyOStream(rcpFromRef(cout)); GlobalBasisMatrix_->describe(*fancy,VERB_EXTREME);
Expand Down
2 changes: 1 addition & 1 deletion packages/shylu/shylu_dd/frosch/src/Tools/FROSch_Output.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
#endif

#ifndef FROSCH_NOTIFICATION
#define FROSCH_NOTIFICATION(CLASS,VERBOSE,OUTPUT) if (VERBOSE) std::cout << std::setw(FROSCH_OUTPUT_INDENT) << " " << CLASS << " : NOTIFICATION: " << OUTPUT << std::endl;
#define FROSCH_NOTIFICATION(CLASS,VERBOSE,OUTPUT) if (VERBOSE) std::cout << std::setw(FROSCH_OUTPUT_INDENT) << " " << "[NOTIFICATION] " << CLASS << ": " << OUTPUT << std::endl;
#endif

#ifndef FROSCH_TEST_OUTPUT
Expand Down

0 comments on commit ec61cfc

Please sign in to comment.