24 class gsThinShellDWRHelper
28 typedef typename gsThinShellAssemblerDWRBase<T>::bContainer bContainer;
32 gsThinShellDWRHelper() {};
35 gsThinShellDWRHelper(gsThinShellAssemblerDWRBase<T> * assembler)
37 m_assembler(assembler)
42 void computeError(
const gsVector<T> & U)
44 gsMultiPatch<T> primalL, deformed;
46 m_assembler->constructSolutionL(U,deformed);
47 m_assembler->constructMultiPatchL(U,primalL);
49 this->computeError(deformed,primalL);
52 void computeError(
const gsMultiPatch<T> & deformed,
const gsMultiPatch<T> primalL,
bool withLoads =
false)
56 this->computeError(deformed,primalL,bnds,points,
true,withLoads);
59 void computeError(
const gsMultiPatch<T> & deformed,
const gsMultiPatch<T> primalL,
bool withLoads =
false,
60 std::string filename = std::string(),
unsigned np=1000,
bool parametric=
false,
bool mesh=
false)
64 this->computeError(deformed,primalL,bnds,points,
true,withLoads,filename,np,parametric,mesh);
67 void computeError(
const gsMultiPatch<T> & deformed,
const gsMultiPatch<T> primalL,
68 const bContainer & bnds,
const gsMatrix<T> & points,
bool interior =
true,
bool withLoads=
false,
69 std::string filename = std::string(),
unsigned np=1000,
bool parametric=
false,
bool mesh=
false)
71 gsMultiPatch<T> dualL, dualH;
72 gsVector<T> solVector;
73 gsVector<T> rhsL(m_assembler->numDofsL());
75 gsVector<T> rhsH(m_assembler->numDofsH());
78 gsSparseSolver<real_t>::uPtr solver;
79 #ifdef GISMO_WITH_PARDISO
80 solver = gsSparseSolver<real_t>::get(
"PardisoLU");
82 solver = gsSparseSolver<real_t>::get(
"LU");
85 gsInfo <<
"Assembling dual matrix (L)... "<< std::flush;
86 m_assembler->assembleMatrixL(deformed);
88 gsInfo <<
"Assembling dual vector (L)... "<< std::flush;
91 m_assembler->assembleDualL(primalL,deformed);
92 rhsL+=m_assembler->dualL();
96 m_assembler->assembleDualL(bnds,primalL,deformed);
97 rhsL+=m_assembler->dualL();
101 m_assembler->assembleDualL(points,primalL,deformed);
102 rhsL+=m_assembler->dualL();
105 gsInfo <<
"Solving dual (L), size = "<<m_assembler->matrixL().rows()<<
","<<m_assembler->matrixL().cols()<<
"... "<< std::flush;
106 solver->compute(m_assembler->matrixL());
107 solVector = solver->solve(rhsL);
108 m_assembler->constructMultiPatchL(solVector,dualL);
111 gsInfo <<
"Assembling dual matrix (H)... "<< std::flush;
112 m_assembler->assembleMatrixH(deformed);
114 gsInfo <<
"Assembling dual vector (H)... "<< std::flush;
117 m_assembler->assembleDualH(primalL,deformed);
118 rhsH+=m_assembler->dualH();
122 m_assembler->assembleDualH(bnds,primalL,deformed);
123 rhsH+=m_assembler->dualH();
125 if (points.cols()!=0)
127 m_assembler->assembleDualH(points,primalL,deformed);
128 rhsH+=m_assembler->dualH();
132 gsInfo <<
"Solving dual (H), size = "<<m_assembler->matrixH().rows()<<
","<<m_assembler->matrixH().cols()<<
"... "<< std::flush;
133 solver->compute(m_assembler->matrixH());
134 solVector = solver->solve(rhsH);
135 m_assembler->constructMultiPatchH(solVector,dualH);
138 m_error = m_assembler->computeError(dualL,dualH,deformed,withLoads,filename,np,parametric,mesh);
139 m_errors = m_assembler->computeErrorElements(dualL,dualH,deformed,withLoads);
140 m_sqerrors = m_assembler->computeSquaredErrorElements(dualL,dualH,deformed,withLoads);
143 T error()
const {
return m_error; }
144 std::vector<T> errors(
bool normalize=
false)
const
148 std::vector<T> result = m_errors;
149 for (
typename std::vector<T>::iterator it = result.begin(); it!=result.end(); it++)
157 std::vector<T> absErrors(
bool normalize=
false)
const
159 std::vector<T> result = m_errors;
162 for (
typename std::vector<T>::iterator it = result.begin(); it!=result.end(); it++)
167 for (
typename std::vector<T>::iterator it = result.begin(); it!=result.end(); it++)
172 std::vector<T> sqErrors(
bool normalize=
false)
const
176 std::vector<T> result = m_sqerrors;
177 for (
typename std::vector<T>::iterator it = result.begin(); it!=result.end(); it++)
178 *it =
std::abs(*it) / (math::pow(m_error,2));
187 gsThinShellAssemblerDWRBase<T> * m_assembler;
189 std::vector<T> m_errors, m_sqerrors;
Provides DWR assembly routines for the Kirchhoff-Love shell.
#define gsInfo
Definition: gsDebug.h:43
EIGEN_STRONG_INLINE abs_expr< E > abs(const E &u)
Absolute value.
Definition: gsExpressions.h:4486