25 #include <FETI_DP_FiniteElementData.h>
32 #define fei_file "FEI_tester.cpp"
43 localProc_(localProc),
69 const char* feiVersionString;
135 if (sname ==
"TEST_LSC") {
144 if (err != 0 || status != 0) {
145 FEI_COUT <<
"!!!! solve returned: err: "<<err<<
", status: "<<status<<
FEI_ENDL;
176 if (sname ==
"TEST_LSC") {
199 if (
MPI_SUCCESS != MPI_Allreduce(&err, &globalErr, 1, MPI_INT, MPI_SUM,
202 if (globalErr != 0) {
215 catch(std::runtime_error& exc) {
315 for(
int j=0; j<1; j++) {
326 for(
int j=0; j<1; j++) {
385 for(
int j=0; j<1; j++) {
398 for(
int j=0; j<1; j++) {
460 double* matScalars =
new double[numMatrices];
465 int rhsScaleID =
rhsIDs[0];
466 double rhsScalar = 1.0;
471 delete [] matScalars;
479 if (sname ==
"TEST_LSC") {
508 std::vector<int> nodeIDs(numNodes);
509 int* nodeIDsPtr = &nodeIDs[0];
516 std::vector<double> data(numNodes*fieldSize, 0.0001);
527 const char* solnFileName,
int numProcs,
533 int maxNumEqnsPerNode = 0;
538 std::vector<double> soln(maxNumEqnsPerNode);
543 std::vector<GlobalID> nodes(numNodes);
544 int* nodesPtr = &nodes[0];
549 if (checkNumNodes != numNodes) {
554 fileName << solnFileName<<
".node."<<solveCounter<<
"."<<numProcs<<
"."<<
localProc;
557 if (!outfile || outfile.bad()) {
558 FEI_COUT <<
"ERROR opening solution output file " << fileName.str() <<
FEI_ENDL;
564 std::vector<int> offsets(2);
566 for(i=0; i<numNodes; ++i) {
568 &offsets[0], &soln[0]) );
570 int numDOF = offsets[1];
572 outfile << nodesPtr[i] <<
" " << numDOF <<
FEI_ENDL;
573 for(
int j=0; j<numDOF; j++) {
574 outfile << soln[j] <<
" ";
584 const char* solnFileName,
590 fileName << solnFileName<<
".elem."<<solveCounter<<
"."<<numProcs<<
"."<<
localProc;
593 if (!outfile || outfile.bad()) {
594 FEI_COUT <<
"ERROR opening elem-solution output file " << fileName.str() <<
FEI_ENDL;
599 if (returnValue != 0)
break;
609 int totalNumElemDOF = numElems*dofPerElem;
611 if (totalNumElemDOF < 1) {
616 if (elemIDs==NULL)
return(-1);
619 if (err) returnValue = 1;
621 int* offsets =
new int[numElems+1];
622 if (offsets == NULL)
return(-1);
624 if (totalNumElemDOF > 0) {
625 double* solnValues =
new double[totalNumElemDOF];
626 if (solnValues == NULL)
return(-1);
629 dofPerElem, solnValues);
630 if (err) returnValue = 1;
633 for(
int j=0; j<numElems; j++) {
635 outfile << (int)elemIDs[j] <<
" " << dofPerElem <<
FEI_ENDL <<
" ";
636 for(
int k=0; k<dofPerElem; k++) {
637 outfile << solnValues[j*dofPerElem + k] <<
" ";
643 delete [] solnValues;
655 const char* solnFileName,
662 int* globalNumCRs =
new int[
numProcs];
664 if (MPI_Allgather(&numCRs, 1, MPI_INT, globalNumCRs, 1, MPI_INT,
670 int localCRStart = 0;
671 for(
int p=0; p<
localProc; p++) localCRStart += globalNumCRs[p];
673 delete [] globalNumCRs;
676 fileName << solnFileName<<
".mult."<<solveCounter<<
"."<<numProcs<<
"."<<
localProc;
679 if (!outfile || outfile.bad()) {
680 FEI_COUT <<
"ERROR opening mult-solution output file " << fileName.str() <<
FEI_ENDL;
684 int* CRIDs = numCRs > 0 ?
new int[numCRs] : NULL;
685 double* results = numCRs > 0 ?
new double[numCRs] : NULL;
687 if (numCRs > 0 && (CRIDs==NULL || results==NULL)) {
698 if (sname ==
"FETI") {
699 for(
int ii=0; ii<numCRs; ++ii) results[ii] = -999.99;
705 for(
int i=0; i<numCRs; i++) {
706 outfile << localCRStart++ <<
" " << 1 <<
FEI_ENDL;
708 outfile <<
" " << results[i] <<
FEI_ENDL;
721 char* current_dir = NULL;
725 solnMtxName<< current_dir<<
"/A_TLSC.mtx";
730 delete [] current_dir;
virtual int getCRMultipliers(int numCRs, const int *CRIDs, double *results)=0
virtual int initSlaveVariable(GlobalID slaveNodeID, int slaveFieldID, int offsetIntoSlaveField, int numMasterNodes, const GlobalID *masterNodeIDs, const int *masterFieldIDs, const double *weights, double rhsValue)=0
virtual int sumInElemMatrix(GlobalID elemBlockID, GlobalID elemID, const GlobalID *elemConn, const double *const *elemStiffness, int elemFormat)=0
virtual int getBlockElemIDList(GlobalID elemBlockID, int numElems, GlobalID *elemIDs)=0
virtual int loadCRPen(int CRPenID, int numCRNodes, const GlobalID *CRNodeIDs, const int *CRFieldIDs, const double *CRWeights, double CRValue, double penValue)=0
double * prescribed_values_
virtual int parameters(int numParams, const char *const *paramStrings)=0
#define FEI_AGGREGATE_SUM
virtual int initComplete()=0
fei::SharedPtr< LibraryWrapper > wrapper_
virtual int setMatScalars(int numScalars, const int *IDs, const double *scalars)=0
virtual int getNumCRMultipliers(int &numMultCRs)=0
virtual int loadNodeBCs(int numNodes, const GlobalID *nodeIDs, int fieldID, const int *offsetsIntoField, const double *prescribedValues)=0
int initializationPhase()
std::string solverLibraryName_
virtual int solve(int &status)=0
#define FEI_Implementation
virtual int getNumBlockElemDOF(GlobalID blockID, int &DOFPerElem) const =0
virtual int putNodalFieldData(int fieldID, int numNodes, const GlobalID *nodeIDs, const double *data)=0
virtual int loadCRMult(int CRMultID, int numCRNodes, const GlobalID *CRNodeIDs, const int *CRFieldIDs, const double *CRWeights, double CRValue)=0
virtual int setRHSScalars(int numScalars, const int *IDs, const double *scalars)=0
virtual int getNumBlockActNodes(GlobalID elemBlockID, int &numNodes) const =0
virtual int initCRMult(int numCRNodes, const GlobalID *CRNodeIDs, const int *CRFieldIDs, int &CRID)=0
virtual int getNumLocalNodes(int &numNodes)=0
virtual int version(const char *&versionString)=0
fei::SharedPtr< DataReader > data_
#define FEI_SINGLE_SYSTEM
virtual int initSharedNodes(int numSharedNodes, const GlobalID *sharedNodeIDs, const int *numProcsPerNode, const int *const *sharingProcIDs)=0
virtual int setCurrentRHS(int rhsID)=0
virtual int initFields(int numFields, const int *fieldSizes, const int *fieldIDs, const int *fieldTypes=NULL)=0
int checkSolution(int localProc, int numProcs, const char *solnFileName, const char *checkFileName, const char *extension, int solveCounter)
virtual int initElemBlock(GlobalID elemBlockID, int numElements, int numNodesPerElement, const int *numFieldsPerNode, const int *const *nodalFieldIDs, int numElemDofFieldsPerElement, const int *elemDOFFieldIDs, int interleaveStrategy)=0
int exercisePutFunctions()
CommNodeSet * sharedNodeSets_
int save_block_node_soln(DataReader &data, FEI &fei, const char *solnFileName, int numProcs, int localProc, int solveCounter)
virtual int setSolveType(int solveType)=0
std::string checkFileName_
void setParameter(const char *param)
virtual int resetMatrix(double s=0.0)=0
int exerciseResidualNorm()
virtual int getNodalSolution(int numNodes, const GlobalID *nodeIDs, int *offsets, double *results)=0
std::ostream & console_out()
virtual int loadComplete(bool applyBCs=true, bool globalAssemble=true)=0
virtual int getBlockElemSolution(GlobalID elemBlockID, int numElems, const GlobalID *elemIDs, int &numElemDOFPerElement, double *results)=0
virtual int resetSystem(double s=0.0)=0
virtual int sumInElemRHS(GlobalID elemBlockID, GlobalID elemID, const GlobalID *elemConn, const double *elemLoad)=0
FEI_tester(fei::SharedPtr< DataReader > data_reader, MPI_Comm comm, int localProc, int numProcs, bool useNewFEI=false)
int readMatrix(const char *baseName, int np, fei::FillableMat &matrix)
std::string solnFileName_
int localProc(MPI_Comm comm)
virtual int resetRHSVector(double s=0.0)=0
virtual int residualNorm(int whichNorm, int numFields, int *fieldIDs, double *norms)=0
virtual int setIDLists(int numMatrices, const int *matrixIDs, int numRHSs, const int *rhsIDs)=0
virtual int iterations(int &itersTaken) const =0
int createFEIinstance(const char *solverName)
virtual int setCurrentMatrix(int matrixID)=0
int save_block_elem_soln(DataReader &data, FEI &fei, const char *solnFileName, int numProcs, int localProc, int solveCounter)
virtual int getLocalNodeIDList(int &numNodes, GlobalID *nodeIDs, int lenNodeIDs)=0
int save_multiplier_soln(DataReader &data, FEI &fei, const char *solnFileName, int numProcs, int localProc, int solveCounter)
int compareMatrices(fei::FillableMat &mat1, fei::FillableMat &mat2)
int getIntParamValue(const char *key, int numParams, const char *const *params, int ¶mValue)
int dirname(const char *name, char *&dir)
#define FEI_OSTRINGSTREAM
fei::SharedPtr< FEI > fei_
virtual int initElem(GlobalID elemBlockID, GlobalID elemID, const GlobalID *elemConn)=0
fei::SharedPtr< LibraryWrapper > create_LibraryWrapper(MPI_Comm comm, const char *libraryName)
virtual int getCRMultIDList(int numMultCRs, int *multIDs)=0
virtual int initCRPen(int numCRNodes, const GlobalID *CRNodeIDs, const int *CRFieldIDs, int &CRID)=0
virtual int getNumBlockElements(GlobalID blockID, int &numElems) const =0
int numProcs(MPI_Comm comm)