Select Git revision
GModelVertexArrays.cpp
Operation_Vector.cpp 5.60 KiB
// GetDP - Copyright (C) 1997-2018 P. Dular and C. Geuzaine, University of Liege
//
// See the LICENSE.txt file for license information. Please report all
// bugs and problems to the public mailing list <getdp@onelab.info>.
#include <map>
#include <string>
#include <vector>
#include "ProData.h"
#include "ProParser.h"
#include "DofData.h"
#include "Message.h"
/* TODO:
Copy[ x() , y() ];
Copy[ "x" , "y" ];
Copy[ "x" , y() ];
Copy[ x() , "y" ];
AXPY[ a, x() , y() ]; // urgent
AXPY[ a , "x", "y" ];// urgent
Norm2[ x(), $nrm2 ]; // urgent
Norm2[ "x", $nrm2 ];
Dot[ "x", "y", $dot ];
Dot[ x(), y(), $dot ]; // urgent
+
1) clarify "from" and "to" in Operation_P->Case.Copy
2) change "Operation_CopyVector" -> "Operation_CopySystemVector"
*/
void Operation_CopyVector(struct Operation *Operation_P,
struct DofData *DofData_P)
{
// this global map is never freed for now
static std::map<std::string, gVector> vectorMap;
gVector *from = 0, *to = 0, tmp;
if(Operation_P->Case.Copy.useList)
LinAlg_CreateVector(&tmp, &DofData_P->Solver, DofData_P->NbrDof) ;
if(Operation_P->Type == OPERATION_COPYSOLUTION){
if(DofData_P->CurrentSolution){
if(Operation_P->Case.Copy.from)
to = &DofData_P->CurrentSolution->x;
else
from = &DofData_P->CurrentSolution->x;
}
else
Message::Error("No current solution available to copy");
}
else if(Operation_P->Type == OPERATION_COPYRHS){
if(Operation_P->Case.Copy.from)
to = &DofData_P->b;
else
from = &DofData_P->b;
}
else if(Operation_P->Type == OPERATION_COPYRESIDUAL){
if(Operation_P->Case.Copy.from)
to = &DofData_P->res;
else
from = &DofData_P->res;
}
else if(Operation_P->Type == OPERATION_COPYINCREMENT){
if(Operation_P->Case.Copy.from)
to = &DofData_P->dx;
else