From 0797f8060b4838351983c975708336daac61104e Mon Sep 17 00:00:00 2001 From: Richard Comblen <richard.comblen@uclouvain.be> Date: Mon, 8 Mar 2010 08:40:06 +0000 Subject: [PATCH] --- Solver/dgDofContainer.cpp | 7 +++++++ Solver/dgGroupOfElements.cpp | 11 ++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/Solver/dgDofContainer.cpp b/Solver/dgDofContainer.cpp index b976dd25f3..c6bce12be8 100644 --- a/Solver/dgDofContainer.cpp +++ b/Solver/dgDofContainer.cpp @@ -204,6 +204,7 @@ void dgDofContainer::load(const std::string name) { } void dgDofContainer::L2Projection(std::string functionName){ + scale(0.); dgDofContainer rhs(&_groups, _nbFields); for (int iGroup=0;iGroup<_groups.getNbElementGroups();iGroup++) { const dgGroupOfElements &group = *_groups.getElementGroup(iGroup); @@ -387,4 +388,10 @@ void dgDofContainer::registerBindings(binding *b){ cm->setDescription("Export the group ids for gmsh visualization"); cm = cb->addMethod("norm",&dgDofContainer::norm); cm->setDescription("Returns the norm of the vector"); + cm = cb->addMethod("scale",(void (dgDofContainer::*)(double))&dgDofContainer::scale); + cm->setArgNames("factor",NULL); + cm->setDescription("this=this*scale"); + cm = cb->addMethod("axpy",(void (dgDofContainer::*)(dgDofContainer &,double)) &dgDofContainer::axpy); + cm->setArgNames("dofContainer","a",NULL); + cm->setDescription("this = this+a*dofContainer"); } diff --git a/Solver/dgGroupOfElements.cpp b/Solver/dgGroupOfElements.cpp index 08c0e9c256..b3f66f316b 100644 --- a/Solver/dgGroupOfElements.cpp +++ b/Solver/dgGroupOfElements.cpp @@ -759,6 +759,9 @@ double dgGroupCollection::splitGroupsForMultirate(int maxLevels,dgConservationLa // localDt[oldGroupId][oldElementId] std::vector<std::vector<double> >localDt; + + std::vector<int>oldGroupIds; + newGroupIds.resize(getNbElementGroups()); elementToNeighbors.resize(getNbElementGroups()); for(int iGroup=0;iGroup<getNbElementGroups();iGroup++){ @@ -921,6 +924,8 @@ double dgGroupCollection::splitGroupsForMultirate(int maxLevels,dgConservationLa for(int i=0;i<forBulk.size();i++){ forBulkV.push_back(getElementGroup(it->first)->getElement(forBulk[i])); } + oldGroupIds.resize(currentNewGroupId+1); + oldGroupIds[currentNewGroupId]=it->first; newGroup=new dgGroupOfElements(forBulkV,oldGroup->getOrder(),oldGroup->getGhostPartition()); newGroup->copyPrivateDataFrom(oldGroup); newGroup->_multirateExponent=currentExponent; @@ -939,6 +944,8 @@ double dgGroupCollection::splitGroupsForMultirate(int maxLevels,dgConservationLa for(int i=0;i<forInnerBuffer.size();i++){ forInnerBufferV.push_back(getElementGroup(it->first)->getElement(forInnerBuffer[i])); } + oldGroupIds.resize(currentNewGroupId+1); + oldGroupIds[currentNewGroupId]=it->first; newGroup=new dgGroupOfElements(forInnerBufferV,oldGroup->getOrder(),oldGroup->getGhostPartition()); newGroup->copyPrivateDataFrom(oldGroup); newGroup->_multirateExponent=currentExponent; @@ -966,6 +973,8 @@ double dgGroupCollection::splitGroupsForMultirate(int maxLevels,dgConservationLa for(int i=0;i<it->second.size();i++){ newGroupV.push_back(getElementGroup(it->first)->getElement(it->second[i])); } + oldGroupIds.resize(currentNewGroupId+1); + oldGroupIds[currentNewGroupId]=it->first; dgGroupOfElements *newGroup=new dgGroupOfElements(newGroupV,oldGroup->getOrder(),oldGroup->getGhostPartition()); newGroup->copyPrivateDataFrom(oldGroup); newGroup->_multirateExponent=currentExponent; @@ -985,7 +994,7 @@ double dgGroupCollection::splitGroupsForMultirate(int maxLevels,dgConservationLa // Some stats int count=0; for(int i=0;i<newGroups.size();i++){ - Msg::Info("%d New group # %d has %d elements",newGroups[i]->getMultirateExponent(),i,newGroups[i]->getNbElements()); + Msg::Info("old: %d, level %d, New group # %d has %d elements",oldGroupIds[i],newGroups[i]->getMultirateExponent(),i,newGroups[i]->getNbElements()); if(newGroups[i]->getIsInnerMultirateBuffer()) Msg::Info("InnerBuffer"); else if(newGroups[i]->getIsOuterMultirateBuffer()) -- GitLab