Skip to content
Snippets Groups Projects
Commit 105473b0 authored by Samuel Melchior's avatar Samuel Melchior
Browse files

code for applying sparse projection

parent 890b478f
No related branches found
No related tags found
No related merge requests found
...@@ -309,35 +309,41 @@ void dgDofContainer::Mesh2Mesh_BuildL2Projection(linearSystemCSRGmm<double> &pro ...@@ -309,35 +309,41 @@ void dgDofContainer::Mesh2Mesh_BuildL2Projection(linearSystemCSRGmm<double> &pro
void dgDofContainer::Mesh2Mesh_ApplyL2Projection(linearSystemCSRGmm<double> &projector,dgDofContainer &donor){ void dgDofContainer::Mesh2Mesh_ApplyL2Projection(linearSystemCSRGmm<double> &projector,dgDofContainer &donor){
scale(0.); scale(0.);
dgGroupCollection* dGroups = donor.getGroups();
dgGroupCollection* rGroups = this->getGroups();
std::vector<int> dGroupsStartIGlobal(dGroups->getNbElementGroups() + 1);
int iGlobal = 0; // indices in global container
dGroupsStartIGlobal[0] = 0;
for (int i = 1; i<dGroupsStartIGlobal.size(); i++)
dGroupsStartIGlobal[i] = dGroupsStartIGlobal[i-1] + dGroups->getElementGroup(i-1)->getNbElements()*dGroups->getElementGroup(i-1)->getNbNodes();
int *startIndex; int *startIndex;
int *columns; int *columns;
double *values; double *values;
projector.getMatrix(startIndex,columns,values); projector.getMatrix(startIndex,columns,values);
/*nt nbCoarseNodes = 0; // OLD CODE
int nbCoarseElements = 0; int nbFields = 0; // TO DEFINE !!!
int r = 0;
for (int kFine = 0;kFine < fineGroups.getNbElementGroups();kFine++) { for (int iGroup=0;iGroup<rGroups->getNbElementGroups();iGroup++) {// for 2d.groups
int nbFineNodes = fineGroups.getElementGroup(kFine)->getNbNodes(); const dgGroupOfElements &rGroup = *rGroups->getElementGroup(iGroup);
fineSol.getGroupProxy(kFine).scale(0); this->getGroupProxy(iGroup).scale(0);
for (int fineElement = 0 ; fineElement<fineGroups.getElementGroup(kFine)->getNbElements() ;++fineElement) { for (int iElement=0 ; iElement<rGroup.getNbElements() ;++iElement) {// for elements
for (int fineNodes = 0 ; fineNodes<nbFineNodes ;++fineNodes) { for (int iNode = 0 ; iNode<rGroup.getNbNodes() ;++iNode) {
int kCoarse = 0; int jGroup = 0;
int c0 = 0; for (int i = startIndex[iGlobal++]; i < startIndex[iGlobal] - 1; i++){
for (int i = startIndex[r++]; i < startIndex[r] - 1; i++){ int jGlobal = columns[i];
int c = columns[i]; for (;jGlobal < dGroupsStartIGlobal[jGroup+1];jGroup++) {
for (;c-c0 < nbCoarseNodes*nbCoarseElements;kCoarse++) { }
c0 += nbCoarseNodes*nbCoarseElements; int jElement = (jGlobal-dGroupsStartIGlobal[jGroup])/dGroups->getElementGroup(jGroup)->getNbNodes();
nbCoarseNodes = coarseGroups.getElementGroup(kCoarse)->getNbNodes(); int jNode = jGlobal-dGroupsStartIGlobal[jGroup]-jElement*dGroups->getElementGroup(jGroup)->getNbNodes();
nbCoarseElements = coarseGroups.getElementGroup(kCoarse)->getNbElements();
}
int coarseElement = (c-c0)/nbCoarseNodes;
int coarseNodes = c-c0-nbCoarseNodes*coarseElement;
for (int m = 0; m < nbFields; m++){ for (int m = 0; m < nbFields; m++){
(fineSol.getGroupProxy(kFine))(fineNodes,fineElement*nbFields+m) += values[i]*(coarseSol.getGroupProxy(kCoarse))(coarseNodes,coarseElement*nbFields+m); (this->getGroupProxy(iGroup))(iNode,iElement*nbFields+m) += values[i]*(donor.getGroupProxy(jGroup))(jNode,jElement*nbFields+m);
}
} }
} }
}//*/
} }
}*/
} }
void dgDofContainer::exportGroupIdMsh(){ void dgDofContainer::exportGroupIdMsh(){
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment