MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
NonlinearSolverTest Class Referenceabstract

#include <nonlin.h>

Inheritance diagram for NonlinearSolverTest:

Public Types

enum  Type { NONE, NORM, MINMAX, LASTNONLINEARSOLVERTEST }
 

Public Member Functions

virtual ~NonlinearSolverTest (void)
 
virtual doublereal MakeTest (Solver *pS, const integer &Size, const VectorHandler &Vec, bool bResidual=false, doublereal dScaleAlgEqu=1., doublereal *pTestDiff=0)
 
virtual void TestOne (doublereal &dRes, const VectorHandler &Vec, const integer &iIndex, doublereal dCoef) const =0
 
virtual void TestMerge (doublereal &dResCurr, const doublereal &dResNew) const =0
 
virtual doublereal TestPost (const doublereal &dRes) const
 
virtual const doublerealdScaleCoef (const integer &iIndex) const
 

Detailed Description

Definition at line 74 of file nonlin.h.

Member Enumeration Documentation

Enumerator
NONE 
NORM 
MINMAX 
LASTNONLINEARSOLVERTEST 

Definition at line 76 of file nonlin.h.

Constructor & Destructor Documentation

NonlinearSolverTest::~NonlinearSolverTest ( void  )
virtual

Definition at line 57 of file nonlin.cc.

References NO_OP.

58 {
59  NO_OP;
60 }
#define NO_OP
Definition: myassert.h:74

Member Function Documentation

const doublereal & NonlinearSolverTest::dScaleCoef ( const integer iIndex) const
virtual
doublereal NonlinearSolverTest::MakeTest ( Solver pS,
const integer Size,
const VectorHandler Vec,
bool  bResidual = false,
doublereal  dScaleAlgEqu = 1.,
doublereal pTestDiff = 0 
)
virtual

Definition at line 63 of file nonlin.cc.

References ASSERT, SchurSolutionManager::ComplExchIntRes(), SchurSolutionManager::ComplExchIntSol(), DEBUGCOUTFNAME, DofOrder::DIFFERENTIAL, SchurDataManager::GetDofsList(), SchurDataManager::HowManyDofs(), VectorHandler::iGetSize(), SchurDataManager::LOCAL, order, Solver::pGetDataManager(), Solver::pGetSolutionManager(), SchurSolutionManager::StartExchIntRes(), SchurSolutionManager::StartExchIntSol(), TestOne(), and TestPost().

Referenced by NonlinearSolver::MakeResTest(), and NonlinearSolver::MakeSolTest().

66 {
67  DEBUGCOUTFNAME("NonlinearSolverTestNorm::MakeTest");
68 
69  doublereal dTest = 0.;
70 
71  if (pTestDiff) {
72  *pTestDiff = 0.;
73  }
74 
75 #ifdef USE_SCHUR
76  /* Only residual test is parallelized; the master node
77  * always knows the entire solution */
78  ASSERT(pS != NULL);
79  SchurSolutionManager *pSSM = dynamic_cast<SchurSolutionManager *>(pS->pGetSolutionManager());
80  if (pSSM) {
81  SchurDataManager *pSDM =
82  dynamic_cast<SchurDataManager *>(pS->pGetDataManager());
83  ASSERT(pSDM);
84 
85  integer iNumLocDofs = pSDM->HowManyDofs(SchurDataManager::LOCAL);
86  integer *pLocDofs = pSDM->GetDofsList(SchurDataManager::LOCAL);
87 
88 #if 0
89  silent_cout("NonlinearSolverTest::MakeTest("
90  << MBDynComm.Get_rank() << ") "
91  "iNumLocDofs=" << iNumLocDofs << std::endl);
92 #endif
93 
94  if (bResidual) {
95  /*
96  * Chiama la routine di comunicazione per la trasmissione
97  * del residuo delle interfacce
98  */
99  pSSM->StartExchIntRes();
100 
101  /* calcola il test per i dofs locali */
102  for (int iCnt = 0; iCnt < iNumLocDofs; iCnt++) {
103  TestOne(dTest, Vec, pLocDofs[iCnt]);
104  }
105 
106  /* collect contributions from other nodes,
107  * plus that of the interface; merge them according
108  * to the NonlinearSolverTest type */
109  pSSM->ComplExchIntRes(dTest, this);
110 
111  } else {
112  /*
113  * Chiama la routine di comunicazione per la trasmissione
114  * del residuo delle interfacce
115  */
116  pSSM->StartExchIntSol();
117 
118  /* calcola il test per i dofs locali */
119  for (int iCnt = 0; iCnt < iNumLocDofs; iCnt++) {
120  TestOne(dTest, Vec, pLocDofs[iCnt]);
121  }
122 
123  /* collect contributions from other nodes,
124  * plus that of the interface; merge them according
125  * to the NonlinearSolverTest type */
126  pSSM->ComplExchIntSol(dTest, this);
127  }
128 
129  } else
130 #endif // USE_SCHUR
131  {
132  ASSERT(Vec.iGetSize() == Size);
133  const DataManager* const pDM = pS->pGetDataManager();
134 
135  for (int iCntp1 = 1; iCntp1 <= Size; iCntp1++) {
136  const DofOrder::Order order = pDM->GetEqType(iCntp1);
137  const doublereal dCoef = order == DofOrder::DIFFERENTIAL ? 1. : dScaleAlgEqu;
138 
139  TestOne(dTest, Vec, iCntp1, dCoef);
140 
141  if (pTestDiff && order == DofOrder::DIFFERENTIAL) {
142  TestOne(*pTestDiff, Vec, iCntp1, dCoef);
143  }
144  }
145  }
146 
147  if (pTestDiff) {
148  *pTestDiff = TestPost(*pTestDiff);
149  }
150 
151  return TestPost(dTest);
152 }
integer * GetDofsList(DofType who) const
virtual SolutionManager * pGetSolutionManager(void) const
Definition: solver.h:398
void ComplExchIntRes(doublereal &d, const NonlinearSolverTest *t)
#define DEBUGCOUTFNAME(fname)
Definition: myassert.h:256
void StartExchIntSol(void)
virtual integer iGetSize(void) const =0
enum @55 order
#define ASSERT(expression)
Definition: colamd.c:977
void StartExchIntRes(void)
integer HowManyDofs(DofType who) const
void ComplExchIntSol(doublereal &d, const NonlinearSolverTest *t)
virtual DataManager * pGetDataManager(void) const
Definition: solver.h:395
virtual void TestOne(doublereal &dRes, const VectorHandler &Vec, const integer &iIndex, doublereal dCoef) const =0
double doublereal
Definition: colamd.c:52
long int integer
Definition: colamd.c:51
virtual doublereal TestPost(const doublereal &dRes) const
Definition: nonlin.cc:155

Here is the call graph for this function:

virtual void NonlinearSolverTest::TestMerge ( doublereal dResCurr,
const doublereal dResNew 
) const
pure virtual
virtual void NonlinearSolverTest::TestOne ( doublereal dRes,
const VectorHandler Vec,
const integer iIndex,
doublereal  dCoef 
) const
pure virtual
doublereal NonlinearSolverTest::TestPost ( const doublereal dRes) const
virtual

Reimplemented in NonlinearSolverTestRange, and NonlinearSolverTestNorm.

Definition at line 155 of file nonlin.cc.

References MBDYN_EXCEPT_ARGS.

Referenced by MakeTest(), and NonlinearSolverTestRange::TestPost().

156 {
157  if (!std::isfinite(dRes)) {
159  }
160 
161  return dRes;
162 }
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63

The documentation for this class was generated from the following files: