33 #ifndef __H__UG__LIB_DISC__FUNCTION_SPACES__INTEGRATE__
34 #define __H__UG__LIB_DISC__FUNCTION_SPACES__INTEGRATE__
38 #include <boost/function.hpp>
64 template <
typename TGr
idFunction>
97 template <
typename TElem>
98 size_t dof_indices(TElem* elem, std::vector<DoFIndex>& ind,
bool bHang =
false,
bool bClear =
true)
const
119 template <
typename TData,
int TWorldDim>
147 const size_t numIP) = 0;
154 const size_t numIP) = 0;
161 const size_t numIP) = 0;
179 template <
typename TData,
int TWorldDim,
typename TImpl>
199 getImpl().template evaluate<1>(vValue,vGlobIP,pElem,vCornerCoords,vLocIP,vJT,numIP);
209 getImpl().template evaluate<2>(vValue,vGlobIP,pElem,vCornerCoords,vLocIP,vJT,numIP);
219 getImpl().template evaluate<3>(vValue,vGlobIP,pElem,vCornerCoords,vLocIP,vJT,numIP);
225 TImpl&
getImpl() {
return static_cast<TImpl&
>(*this);}
228 const TImpl&
getImpl()
const {
return static_cast<const TImpl&
>(*this);}
259 template <
int WorldDim,
int dim,
typename TConstIterator>
261 TConstIterator iterEnd,
264 int quadOrder, std::string quadType,
267 *paaElemContribs = NULL
277 TConstIterator iter = iterBegin;
284 if(quadType.empty()) quadType =
"best";
290 aaElemContribs = *paaElemContribs;
293 std::vector<MathVector<WorldDim> > vCorner;
294 std::vector<MathVector<WorldDim> > vGlobIP;
295 std::vector<MathMatrix<dim, WorldDim> > vJT;
296 std::vector<number> vValue;
299 for(; iter != iterEnd; ++iter)
302 grid_base_object* pElem = *iter;
314 = ReferenceMappingProvider::get<dim, WorldDim>(roid);
317 const size_t numIP = rQuadRule.
size();
323 mapping.
update(&vCorner[0]);
326 vGlobIP.resize(numIP);
334 vValue.resize(numIP);
337 integrand.
values(&(vValue[0]), &(vGlobIP[0]),
338 pElem, &vCorner[0], rQuadRule.
points(),
342 UG_CATCH_THROW(
"Unable to compute values of integrand at integration point.");
348 for(
size_t ip = 0; ip < numIP; ++ip)
357 intValElem += vValue[ip] * weightIP * det;
361 integral += intValElem;
362 if(aaElemContribs.
valid())
363 aaElemContribs[pElem] = intValElem;
372 template <
typename TGr
idFunction,
int dim>
374 TGridFunction& spGridFct,
375 int si,
int quadOrder, std::string quadType)
378 typedef typename TGridFunction::template dim_traits<dim>::grid_base_object grid_base_object;
379 typedef typename TGridFunction::template dim_traits<dim>::const_iterator const_iterator;
383 return Integrate<TGridFunction::dim,dim,const_iterator>
384 (spGridFct.template begin<grid_base_object>(si),
385 spGridFct.template end<grid_base_object>(si),
386 spGridFct.domain()->position_accessor(),
388 quadOrder, quadType);
392 template <
typename TGr
idFunction>
394 TGridFunction& spGridFct,
395 const char* subsets,
int quadOrder,
396 std::string quadType = std::string())
402 SubsetGroup ssGrp(spGridFct.domain()->subset_handler());
407 "Cannot integrate on subsets of different dimensions.");
408 UG_LOG(
"IntegrateSubsets for subsets="<<subsets<<
"\n");
421 for(
size_t i = 0; i < ssGrp.
size(); ++i)
424 const int si = ssGrp[i];
428 " world dimension is "<<
dim<<
". Cannot integrate this.");
435 case 1: value += IntegrateSubset<TGridFunction, 1>(spIntegrand, spGridFct, si, quadOrder, quadType);
break;
436 case 2: value += IntegrateSubset<TGridFunction, 2>(spIntegrand, spGridFct, si, quadOrder, quadType);
break;
437 case 3: value += IntegrateSubset<TGridFunction, 3>(spIntegrand, spGridFct, si, quadOrder, quadType);
break;
438 default:
UG_THROW(
"IntegrateSubsets: Dimension "<<ssGrp.
dim(i)<<
" not supported. "
439 " World dimension is "<<
dim<<
".");
442 UG_CATCH_THROW(
"IntegrateSubsets: Integration failed on subset "<<si);
465 template <
typename TData,
typename TGr
idFunction>
467 :
public StdIntegrand<TData, TGridFunction::dim, UserDataIntegrand<TData, TGridFunction> >
489 TGridFunction* spGridFct,
493 m_spData->set_function_pattern(spGridFct->function_pattern());
502 "UserDataIntegrand: Missing GridFunction, but data requires grid function.");
506 template <
int elemDim>
533 (*m_spData)(vValue, vGlobIP,
m_time, this->
m_si, pElem,
534 vCornerCoords, vLocIP, numIP, &u, &vJT[0]);
542 (*m_spData)(vValue, vGlobIP,
m_time, this->
m_si, numIP);
554 template <
typename TData,
typename TGr
idFunction>
556 :
public StdIntegrand<number, TGridFunction::dim, UserDataIntegrandSq<TData, TGridFunction> >
578 const TGridFunction* pGridFct,
582 m_spData->set_function_pattern(pGridFct->function_pattern());
591 UG_THROW(
"UserDataIntegrand: Missing GridFunction, but "
592 " data requires grid function.")
597 template <
int elemDim>
607 std::vector<TData> tmpValues(numIP);
628 (*m_spData)(&tmpValues.front(), vGlobIP,
m_time, this->
m_si, pElem,
629 vCornerCoords, vLocIP, numIP, &u, &vJT[0]);
637 (*m_spData)(&tmpValues.front(), vGlobIP,
m_time, this->
m_si, numIP);
642 for (
size_t i=0; i<numIP; ++i)
644 vValue[i]=
inner_prod(tmpValues[i], tmpValues[i]);
658 {
UG_ASSERT(0,
"NOT IMPLEMENTED");
return 0.0;}
665 template <
typename TData,
typename TGr
idFunction>
667 :
public StdIntegrand<number, TGridFunction::dim, UserDataDistIntegrandSq<TData, TGridFunction> >
694 TGridFunction& coarseGridFct,
size_t coarseCmp)
700 UG_THROW(
"UserDataDistIntegrandSq: fine and top level inverted.");
703 UG_THROW(
"UserDataDistIntegrandSq: grid functions defined on different domains.");
712 UG_THROW(
"UserDataDistIntegrandSq: Grid function component"
713 <<
m_fineData.fct()<<
" not defined on subset "<<si);
715 UG_THROW(
"UserDataDistIntegrandSq: Grid function component"
721 template <
int elemDim>
733 if(!
m_spData->requires_grid_fct()) {
734 for (
size_t i=0; i<numIP; ++i) { vValue[i]=0.0; }
741 int parentLevel =
m_spMG->get_level(pCoarseElem);
743 pCoarseElem =
m_spMG->get_parent(pCoarseElem);
744 parentLevel =
m_spMG->get_level(pCoarseElem);
749 typedef typename TGridFunction::template dim_traits<elemDim>::grid_base_object TElem;
750 std::vector<MathVector<worldDim> > vCornerCoarse;
756 = ReferenceMappingProvider::get<elemDim, worldDim>(coarseROID, vCornerCoarse);
758 std::vector<MathVector<elemDim> > vCoarseLocIP;
759 vCoarseLocIP.resize(numIP);
760 for(
size_t ip = 0; ip < vCoarseLocIP.size(); ++ip)
VecSet(vCoarseLocIP[ip], 0.0);
781 TData fineValues[numIP];
782 TData coarseValues[numIP];
791 m_coarseData.grid_function().indices(pCoarseElem, indCoarse);
792 uCoarse.
resize(indCoarse);
795 (*m_spData)(coarseValues, vGlobIP,
m_time, this->
m_si, pCoarseElem,
796 &vCornerCoarse[0], &vCoarseLocIP[0], numIP, &uCoarse, &vJT[0]);
797 }
UG_CATCH_THROW(
"UserDataDistIntegrandSq: Cannot evaluate coarse data.");
805 m_fineData.grid_function().indices(pFineElem, indFine);
809 (*m_spData)(fineValues, vGlobIP,
m_time, this->
m_si, pFineElem,
810 vCornerCoords, vFineLocIP, numIP, &uFine, &vJT[0]);
811 }
UG_CATCH_THROW(
"UserDataDistIntegrandSq: Cannot evaluate fine data.");
814 for(
size_t ip = 0; ip < numIP; ++ip)
816 vValue[ip] =
inner_dist2(fineValues[ip], coarseValues[ip]);
832 {
UG_ASSERT(0,
"NOT IMPLEMENTED");
return 0.0;}
837 {
return (v1-v2)*(v1-v2); }
844 {
UG_ASSERT(0,
"NOT IMPLEMENTED");
return 0.0;}
855 template <
typename TGr
idFunction>
857 TGridFunction& spGridFct,
858 const char* subsets,
number time,
859 int quadOrder, std::string quadType)
862 return IntegrateSubsets(spIntegrand, spGridFct, subsets, quadOrder, quadType);
865 template <
typename TGr
idFunction>
867 const char* subsets,
number time,
int quadOrder, std::string quadType)
868 {
return Integral(spData, *spGridFct, subsets, time, quadOrder, quadType); }
870 template <
typename TGr
idFunction>
872 {
return Integral(spData, spGridFct, subsets, time, order,
"best");}
874 template <
typename TGr
idFunction>
876 {
return Integral(spData, spGridFct, subsets, time, 1,
"best");}
878 template <
typename TGr
idFunction>
880 {
return Integral(spData, spGridFct, NULL, time, 1,
"best");}
882 template <
typename TGr
idFunction>
884 {
return Integral(spData, spGridFct, subsets, 0.0, 1,
"best");}
886 template <
typename TGr
idFunction>
888 {
return Integral(spData, spGridFct, NULL, 0.0, 1,
"best");}
894 template <
typename TGr
idFunction>
897 number time,
int quadOrder)
902 return Integral(sp, spGridFct, subsets, time, quadOrder);
905 template <
typename TGr
idFunction>
907 {
return Integral(val, spGridFct, subsets, time, 1);}
909 template <
typename TGr
idFunction>
911 {
return Integral(val, spGridFct, NULL, time, 1);}
913 template <
typename TGr
idFunction>
915 {
return Integral(val, spGridFct, subsets, 0.0, 1);}
917 template <
typename TGr
idFunction>
919 {
return Integral(val, spGridFct, NULL, 0.0, 1);}
926 template <
typename TGr
idFunction>
929 const char* subsets,
number time,
930 int quadOrder, std::string quadType)
935 return Integral(sp, *spGridFct, subsets, time, quadOrder, quadType);
938 template <
typename TGr
idFunction>
940 {
return Integral(luaFct, spGridFct, subsets, time, quadOrder,
"best");}
942 template <
typename TGr
idFunction>
944 {
return Integral(luaFct, spGridFct, subsets, time, 1,
"best");}
946 template <
typename TGr
idFunction>
948 {
return Integral(luaFct, spGridFct, NULL, time, 1,
"best");}
950 template <
typename TGr
idFunction>
952 {
return Integral(luaFct, spGridFct, subsets, 0.0, 1,
"best");}
954 template <
typename TGr
idFunction>
956 {
return Integral(luaFct, spGridFct, NULL, 0.0, 1,
"best");}
962 template <
typename TGr
idFunction>
964 :
public StdIntegrand<number, TGridFunction::dim, MaximumDistIntegrand<TGridFunction> >
980 m_max(-
std::numeric_limits<float>::infinity()),
981 m_min(
std::numeric_limits<float>::infinity())
996 m_min = std::numeric_limits<double>::infinity();
997 m_max = -std::numeric_limits<double>::infinity();
1004 template <
int elemDim>
1019 LocalFiniteElementProvider::get<elemDim>(roid,
m_scalarData.id());
1022 const size_t num_sh = rTrialSpace.
num_sh();
1025 std::vector<DoFIndex> ind;
1029 UG_COND_THROW(ind.size() != num_sh,
"L2ErrorIntegrand::evaluate: Wrong number of multi indices.");
1032 for(
size_t sh = 0; sh < num_sh; ++sh)
1042 }
UG_CATCH_THROW(
"L2ErrorIntegrand::evaluate: trial space missing.");
1047 template <
typename TGr
idFunction>
1051 const size_t fct = gridFct.fct_id_by_name(cmp);
1053 "L2Error: Function space does not contain a function with name " << cmp <<
".");
1058 return spIntegrand.
min();
1061 template <
typename TGr
idFunction>
1063 {
return GetMinimum(*spGridFct, cmp, subsets); }
1070 template <
typename TGr
idFunction>
1072 :
public StdIntegrand<number, TGridFunction::dim, L2ErrorIntegrand<TGridFunction> >
1090 TGridFunction& gridFct,
size_t cmp,
1102 UG_THROW(
"L2ErrorIntegrand: Grid function component"
1108 template <
int elemDim>
1123 LocalFiniteElementProvider::get<elemDim>(roid,
m_scalarData.id());
1126 const size_t num_sh = rTrialSpace.
num_sh();
1129 std::vector<DoFIndex> ind;
1133 if(ind.size() != num_sh)
1134 UG_THROW(
"L2ErrorIntegrand::evaluate: Wrong number of"
1138 for(
size_t ip = 0; ip < numIP; ++ip)
1142 (*m_spExactSolution)(exactSolIP, vGlobIP[ip],
m_time, this->
subset());
1145 number approxSolIP = 0.0;
1146 for(
size_t sh = 0; sh < num_sh; ++sh)
1152 approxSolIP += valSH * rTrialSpace.
shape(sh, vLocIP[ip]);
1156 vValue[ip] = (exactSolIP - approxSolIP);
1157 vValue[ip] *= vValue[ip];
1161 UG_CATCH_THROW(
"L2ErrorIntegrand::evaluate: trial space missing.");
1184 template <
typename TGr
idFunction>
1186 TGridFunction& gridFct,
const char* cmp,
1187 number time,
int quadOrder,
const char* subsets)
1190 const size_t fct = gridFct.fct_id_by_name(cmp);
1194 "L2Error: Function space does not contain a function with name " << cmp <<
".");
1200 template <
typename TGr
idFunction>
1203 number time,
int quadOrder,
const char* subsets)
1204 {
return L2Error(spExactSol, *spGridFct, cmp, time, quadOrder, subsets); }
1206 template <
typename TGr
idFunction>
1209 number time,
int quadOrder)
1210 {
return L2Error(spExactSol, *spGridFct, cmp, time, quadOrder, NULL); }
1216 template <
typename TGr
idFunction>
1219 number time,
int quadOrder,
const char* subsets)
1222 =
make_sp(
new LuaUserData<number, TGridFunction::domain_type::dim>(ExactSol));
1223 return L2Error(spExactSol, spGridFct, cmp, time, quadOrder, subsets);
1226 template <
typename TGr
idFunction>
1229 number time,
int quadOrder)
1231 return L2Error(ExactSol, spGridFct, cmp, time, quadOrder, NULL);
1239 template <
int worldDim,
int elemDim>
1240 void CheckGeneralizedInverse(
const MathMatrix<elemDim, worldDim> &JT,
const MathMatrix<worldDim, elemDim> &JTInv)
1242 if (worldDim==elemDim)
return;
1244 MathMatrix<worldDim, elemDim> myTmp;
1249 "The inverse matrix is not identity to the map jacobian transposed inverse.");
1259 template <
typename TGr
idFunction>
1261 :
public StdIntegrand<number, TGridFunction::dim, H1ErrorIntegrand<TGridFunction> >
1284 TGridFunction& gridFct,
size_t cmp,
1296 UG_THROW(
"H1Error: Grid function component"
1302 template <
int elemDim>
1315 = ReferenceMappingProvider::get<elemDim, worldDim>(roid, vCornerCoords);
1320 LocalFiniteElementProvider::get<elemDim>(roid,
m_scalarData.id());
1323 const size_t num_sh = rTrialSpace.
num_sh();
1326 std::vector<DoFIndex> ind;
1330 if(ind.size() != num_sh)
1331 UG_THROW(
"H1ErrorIntegrand::evaluate: Wrong number of"
1335 std::vector<MathVector<elemDim> > vLocGradient(num_sh);
1336 for(
size_t ip = 0; ip < numIP; ++ip)
1340 (*m_spExactSolution)(exactSolIP, vGlobIP[ip],
m_time, this->
subset());
1344 (*m_spExactGrad)(exactGradIP, vGlobIP[ip],
m_time, this->
subset());
1347 rTrialSpace.
grads(&vLocGradient[0], vLocIP[ip]);
1350 number approxSolIP = 0.0;
1352 for(
size_t sh = 0; sh < num_sh; ++sh)
1358 approxSolIP += valSH * rTrialSpace.
shape(sh, vLocIP[ip]);
1370 CheckGeneralizedInverse<worldDim,elemDim>(vJT[ip], JTInv);
1376 vValue[ip] = (exactSolIP - approxSolIP) * (exactSolIP - approxSolIP);
1381 UG_CATCH_THROW(
"H1ErrorIntegrand::evaluate: trial space missing.");
1399 template <
typename TGr
idFunction>
1403 number time,
int quadOrder,
const char* subsets)
1406 const size_t fct = spGridFct->fct_id_by_name(cmp);
1409 if(fct >= spGridFct->num_fct())
1410 UG_THROW(
"H1Error: Function space does not contain"
1411 " a function with name " << cmp <<
".");
1414 return sqrt(
IntegrateSubsets(spIntegrand, *spGridFct, subsets, quadOrder));
1417 template <
typename TGr
idFunction>
1421 number time,
int quadOrder)
1423 return H1Error(spExactSol, spExactGrad, spGridFct, cmp, time, quadOrder, NULL);
1427 template <
typename TGr
idFunction>
1430 number time,
int quadOrder,
const char* subsets)
1434 =
make_sp(
new LuaUserData<number, dim>(ExactSol));
1436 =
make_sp(
new LuaUserData<MathVector<dim>,
dim>(ExactGrad));
1437 return H1Error(spExactSol, spExactGrad, spGridFct, cmp, time, quadOrder, subsets);
1440 template <
typename TGr
idFunction>
1443 number time,
int quadOrder)
1445 return H1Error(ExactSol, ExactGrad, spGridFct, cmp, time, quadOrder, NULL);
1465 template <
typename TDistIntegrand,
typename TGr
idFunction>
1467 TGridFunction& spGridFct2,
const char* cmp2,
1468 int quadOrder,
const char* subsets)
1471 const size_t fct1 = spGridFct1.fct_id_by_name(cmp1);
1472 const size_t fct2 = spGridFct2.fct_id_by_name(cmp2);
1475 if(fct1 >= spGridFct1.num_fct())
1476 UG_THROW(
"GridFunctionDistance: Function space does not contain"
1477 " a function with name " << cmp1 <<
".");
1478 if(fct2 >= spGridFct2.num_fct())
1479 UG_THROW(
"GridFunctionDistance: Function space does not contain"
1480 " a function with name " << cmp2 <<
".");
1483 const int level1 = spGridFct1.dof_distribution()->grid_level().level();
1484 const int level2 = spGridFct2.dof_distribution()->grid_level().level();
1486 if(level1 > level2){
1488 TDistIntegrand spIntegrand(spGridFct1, fct1, spGridFct2, fct2);
1491 TDistIntegrand spIntegrand(spGridFct2, fct2, spGridFct1, fct1);
1498 template <
typename TDistIntegrand,
typename TGr
idFunction>
1500 TGridFunction& spGridFct2,
const char* cmp2,
1504 const size_t fct1 = spGridFct1.fct_id_by_name(cmp1);
1505 const size_t fct2 = spGridFct2.fct_id_by_name(cmp2);
1508 if(fct1 >= spGridFct1.num_fct())
1509 UG_THROW(
"GridFunctionDistance: Function space does not contain"
1510 " a function with name " << cmp1 <<
".");
1511 if(fct2 >= spGridFct2.num_fct())
1512 UG_THROW(
"GridFunctionDistance: Function space does not contain"
1513 " a function with name " << cmp2 <<
".");
1516 const int level1 = spGridFct1.dof_distribution()->grid_level().level();
1517 const int level2 = spGridFct2.dof_distribution()->grid_level().level();
1520 if(level1 > level2){
1521 TDistIntegrand spIntegrand(spGridFct1, fct1, spGridFct2, fct2, spWeights);
1524 TDistIntegrand spIntegrand(spGridFct2, fct2, spGridFct1, fct1, spWeights);
1531 template <
typename TDistIntegrand,
typename TGr
idFunction>
1533 TGridFunction& spGridFct2,
const char* cmp2,
1534 int quadOrder,
const char* subsets,
1539 const size_t fct1 = spGridFct1.fct_id_by_name(cmp1);
1540 const size_t fct2 = spGridFct2.fct_id_by_name(cmp2);
1543 if(fct1 >= spGridFct1.num_fct())
1544 UG_THROW(
"GridFunctionDistance: Function space does not contain"
1545 " a function with name " << cmp1 <<
".");
1546 if(fct2 >= spGridFct2.num_fct())
1547 UG_THROW(
"GridFunctionDistance: Function space does not contain"
1548 " a function with name " << cmp2 <<
".");
1551 const int level1 = spGridFct1.dof_distribution()->grid_level().level();
1552 const int level2 = spGridFct2.dof_distribution()->grid_level().level();
1555 if(level1 > level2){
1556 TDistIntegrand spIntegrand(spGridFct1, fct1, spGridFct2, fct2, spWeights, distAvg12);
1559 TDistIntegrand spIntegrand(spGridFct2, fct2, spGridFct1, fct1, spWeights, -distAvg12);
1571 template <
typename TGr
idFunction>
1573 :
public StdIntegrand<number, TGridFunction::dim, L2Integrand<TGridFunction> >
1604 UG_THROW(
"L2ErrorIntegrand: Grid function component" <<
m_scalarData.fct() <<
" not defined on subset "<<si);
1609 template <
int elemDim>
1623 std::vector<ipdata_type> locElemWeights(numIP, 1.0);
1630 LocalFiniteElementProvider::get<elemDim>(roid,
m_scalarData.id());
1633 const size_t num_sh = rTrialSpace.
num_sh();
1636 std::vector<DoFIndex> ind;
1640 if(ind.size() != num_sh)
1641 UG_THROW(
"L2Integrand::evaluate: Wrong number of multi indices.");
1644 for(
size_t ip = 0; ip < numIP; ++ip)
1648 number approxSolIP = 0.0;
1649 for(
size_t sh = 0; sh < num_sh; ++sh)
1654 approxSolIP += valSH * rTrialSpace.
shape(sh, vLocIP[ip]);
1658 vValue[ip] = locElemWeights[ip]*approxSolIP*approxSolIP;
1679 template <
typename TGr
idFunction>
1681 int quadOrder,
const char* subsets,
1685 const size_t fct = u.fct_id_by_name(cmp);
1688 UG_COND_THROW(fct >= u.num_fct(),
"L2Norm: Function space does not contain"
1689 " a function with name " << cmp <<
".");
1695 template <
typename TGr
idFunction>
1697 int quadOrder,
const char* subsets)
1700 const size_t fct = u.fct_id_by_name(cmp);
1703 UG_COND_THROW(fct >= u.num_fct(),
"L2Norm: Function space does not contain"
1704 " a function with name " << cmp <<
".");
1710 template <
typename TGr
idFunction>
1712 int quadOrder,
const char* subsets)
1714 return sqrt(
L2Norm2(u, cmp, quadOrder, subsets));
1724 template <
typename TGr
idFunction>
1726 {
return L2Norm(gridFct, cmp, quadOrder, NULL); }
1728 template <
typename TGr
idFunction>
1730 {
return L2Norm(*spGridFct, cmp, quadOrder, subsets); }
1732 template <
typename TGr
idFunction>
1734 {
return L2Norm(spGridFct, cmp, quadOrder, NULL); }
1738 template <
typename TGr
idFunction>
1740 :
public StdIntegrand<number, TGridFunction::dim, L2DistIntegrand<TGridFunction> >
1766 TGridFunction& coarseGridFct,
size_t coarseCmp)
1773 "L2DiffIntegrand: fine and top level inverted.");
1775 "L2DiffIntegrand: grid functions defined on different domains.");
1787 "L2DiffIntegrand: fine and top level inverted.");
1789 "L2DiffIntegrand: grid functions defined on different domains.");
1801 "L2DiffIntegrand: fine and top level inverted.");
1803 "L2DiffIntegrand: grid functions defined on different domains.");
1813 "L2DiffIntegrand: Grid function component" <<
m_fineData.fct()<<
" not defined on subset "<<si);
1815 "L2DiffIntegrand: Grid function component" <<
m_coarseData.fct()<<
" not defined on subset "<<si);
1820 template <
int elemDim>
1829 typedef typename TGridFunction::template dim_traits<elemDim>::grid_base_object Element;
1834 int parentLevel =
m_spMG->get_level(pCoarseElem);
1836 pCoarseElem =
m_spMG->get_parent(pCoarseElem);
1837 parentLevel =
m_spMG->get_level(pCoarseElem);
1846 std::vector<MathVector<worldDim> > vCornerCoarse;
1851 = ReferenceMappingProvider::get<elemDim, worldDim>(coarseROID, vCornerCoarse);
1853 std::vector<MathVector<elemDim> > vCoarseLocIP;
1854 vCoarseLocIP.resize(numIP);
1855 for(
size_t ip = 0; ip < vCoarseLocIP.size(); ++ip)
VecSet(vCoarseLocIP[ip], 0.0);
1860 std::vector<ipdata_type> fineElemWeights(numIP, 1.0);
1867 LocalFiniteElementProvider::get<elemDim>(fineROID,
m_fineData.id());
1869 LocalFiniteElementProvider::get<elemDim>(coarseROID,
m_coarseData.id());
1872 std::vector<DoFIndex> vFineMI, vCoarseMI;
1877 for(
size_t ip = 0; ip < numIP; ++ip)
1881 for(
size_t sh = 0; sh < vFineMI.size(); ++sh)
1887 fineSolIP += val * rFineLSFS.
shape(sh, vFineLocIP[ip]);
1889 number coarseSolIP = 0.0;
1890 for(
size_t sh = 0; sh < vCoarseMI.size(); ++sh)
1896 coarseSolIP += val * rCoarseLSFS.
shape(sh, vCoarseLocIP[ip]);
1904 UG_CATCH_THROW(
"L2DistIntegrand::evaluate: trial space missing.");
1910 template <
typename TGr
idFunction>
1912 TGridFunction& spGridFct2,
const char* cmp2,
1913 int quadOrder,
const char* subsets,
1916 return GridFunctionDistance2<L2DistIntegrand<TGridFunction>, TGridFunction>
1917 (spGridFct1, cmp1, spGridFct2, cmp2, quadOrder, subsets, spWeight, avgDist12);
1922 template <
typename TGr
idFunction>
1924 TGridFunction& spGridFct2,
const char* cmp2,
1925 int quadOrder,
const char* subsets)
1927 return GridFunctionDistance2<L2DistIntegrand<TGridFunction>, TGridFunction>
1928 (spGridFct1, cmp1, spGridFct2, cmp2, quadOrder, subsets);
1932 template <
typename TGr
idFunction>
1934 TGridFunction& spGridFct2,
const char* cmp2,
1935 int quadOrder,
const char* subsets)
1937 return sqrt(
L2Distance2(spGridFct1, cmp1, spGridFct2, cmp2, quadOrder, subsets));
1941 template <
typename TGr
idFunction>
1946 return L2Distance(*spGridFct1, cmp1, *spGridFct2, cmp2, quadOrder, NULL);
1949 template <
typename TGr
idFunction>
1952 int quadOrder,
const char* subsets)
1954 return L2Distance(*spGridFct1, cmp1, *spGridFct2, cmp2, quadOrder, subsets);
1964 template <
typename TGr
idFunction>
1966 :
public StdIntegrand<number, TGridFunction::dim, H1SemiIntegrand<TGridFunction> >
2002 template <
int elemDim>
2013 const TGridFunction &gridFct=
m_scalarData.grid_function();
2016 = ReferenceMappingProvider::get<elemDim, worldDim>(roid, vCornerCoords);
2029 gridFct.indices(pElem, ind);
2036 vCornerCoords, vLocIP, numIP, &uloc, NULL);
2037 }
UG_CATCH_THROW(
"H1SemiIntegrand: Cannot evaluate weight data.");
2044 }
UG_CATCH_THROW(
"H1SemiIntegrand: Cannot evaluate weight data.");
2055 LocalFiniteElementProvider::get<elemDim>(roid,
m_scalarData.id());
2058 const size_t num_sh = rTrialSpace.
num_sh();
2061 std::vector<DoFIndex> ind;
2065 UG_COND_THROW(ind.size() != num_sh,
"H1SemiNormFuncIntegrand::evaluate: Wrong number of multi-)indices.");
2068 std::vector<MathVector<elemDim> > vLocGradient(num_sh);
2069 for(
size_t ip = 0; ip < numIP; ++ip)
2072 rTrialSpace.
grads(&vLocGradient[0], vLocIP[ip]);
2075 number approxSolIP = 0.0;
2077 for(
size_t sh = 0; sh < num_sh; ++sh)
2083 approxSolIP += valSH * rTrialSpace.
shape(sh, vLocIP[ip]);
2095 CheckGeneralizedInverse<worldDim,elemDim>(vJT[ip], JTInv);
2102 MatVecMult(approxDGradIP, elemWeights[ip], approxGradIP);
2103 vValue[ip] =
VecDot(approxDGradIP, approxGradIP);
2107 UG_CATCH_THROW(
"H1SemiIntegrand::evaluate: trial space missing.");
2124 template <
typename TGr
idFunction>
2125 number H1SemiNorm2(TGridFunction& gridFct,
const char* cmp,
int quadOrder,
const char* subsets=NULL,
2129 const size_t fct = gridFct.fct_id_by_name(cmp);
2132 UG_COND_THROW(fct >= gridFct.num_fct(),
"H1SemiNorm: Function space does not contain"
2133 " a function with name " << cmp <<
".");
2134 if (weights.invalid()) {
2144 template <
typename TGr
idFunction>
2145 number H1SemiNorm(TGridFunction& gridFct,
const char* cmp,
int quadOrder,
const char* subsets=NULL,
2148 return (sqrt(
H1SemiNorm2(gridFct, cmp, quadOrder, subsets, weights)));
2152 template <
typename TGr
idFunction>
2154 {
return H1SemiNorm(*spGridFct, cmp, quadOrder, subsets); }
2156 template <
typename TGr
idFunction>
2159 {
return H1SemiNorm(*spGridFct, cmp, quadOrder, subsets, weights); }
2161 template <
typename TGr
idFunction>
2163 {
return H1SemiNorm(*spGridFct, cmp, quadOrder, NULL); }
2165 template <
typename TGr
idFunction>
2168 {
return H1SemiNorm(*spGridFct, cmp, quadOrder, NULL, weights); }
2171 template <
typename TGr
idFunction>
2195 TGridFunction& coarseGridFct,
size_t coarseCmp)
2197 m_fineTopLevel(fineGridFct.dof_distribution()->grid_level().level()),
2200 m_spMG(fineGridFct.domain()->grid()),
2204 UG_THROW(
"H1SemiDiffIntegrand: fine and top level inverted.");
2207 UG_THROW(
"H1SemiDiffIntegrand: grid functions defined on different domains.");
2212 TGridFunction& coarseGridFct,
size_t coarseCmp,
2215 m_fineTopLevel(fineGridFct.dof_distribution()->grid_level().level()),
2218 m_spMG(fineGridFct.domain()->grid()),
2231 <<
m_fineData.fct()<<
" not defined on subset "<<si);
2238 template <
int elemDim>
2247 typedef typename TGridFunction::template dim_traits<elemDim>::grid_base_object Element;
2249 const TGridFunction &fineGridFct =
m_fineData.grid_function();
2250 const TGridFunction &coarseGridFct =
m_coarseData.grid_function();
2255 int parentLevel =
m_spMG->get_level(pCoarseElem);
2257 pCoarseElem =
m_spMG->get_parent(pCoarseElem);
2258 parentLevel =
m_spMG->get_level(pCoarseElem);
2267 std::vector<MathVector<worldDim> > vCornerCoarse;
2272 = ReferenceMappingProvider::get<elemDim, worldDim>(coarseROID, vCornerCoarse);
2274 = ReferenceMappingProvider::get<elemDim, worldDim>(fineROID, vCornerCoords);
2276 std::vector<MathVector<elemDim> > vCoarseLocIP;
2277 vCoarseLocIP.resize(numIP);
2278 for(
size_t ip = 0; ip < vCoarseLocIP.size(); ++ip)
VecSet(vCoarseLocIP[ip], 0.0);
2292 fineGridFct.indices(pFineElem, ind);
2299 vCornerCoords, vFineLocIP, numIP, &u, NULL);
2315 LocalFiniteElementProvider::get<elemDim>(fineROID,
m_fineData.id());
2317 LocalFiniteElementProvider::get<elemDim>(coarseROID,
m_coarseData.id());
2320 std::vector<DoFIndex> vFineMI, vCoarseMI;
2324 std::vector<MathVector<elemDim> > vFineLocGradient(vFineMI.size());
2325 std::vector<MathVector<elemDim> > vCoarseLocGradient(vCoarseMI.size());
2328 for(
size_t ip = 0; ip < numIP; ++ip)
2331 rFineLSFS.
grads(&vFineLocGradient[0], vFineLocIP[ip]);
2332 rCoarseLSFS.
grads(&vCoarseLocGradient[0], vCoarseLocIP[ip]);
2337 for(
size_t sh = 0; sh < vFineMI.size(); ++sh)
2340 fineSolIP += val * rFineLSFS.
shape(sh, vFineLocIP[ip]);
2344 number coarseSolIP = 0.0;
2346 for(
size_t sh = 0; sh < vCoarseMI.size(); ++sh)
2348 const number val =
DoFRef(coarseGridFct, vCoarseMI[sh]);
2349 coarseSolIP += val * rCoarseLSFS.
shape(sh, vCoarseLocIP[ip]);
2359 CheckGeneralizedInverse<worldDim,elemDim>(vJT[ip], fineJTInv);
2362 MatVecMult(fineGradIP, fineJTInv, fineLocTmp);
2368 MatVecMult(coarseGradIP, coarseJTInv, coarseLocTmp);
2373 vValue[ip] =
VecDistanceSq(coarseGradIP, fineGradIP, elemWeights[ip]);
2377 UG_CATCH_THROW(
"H1SemiDiffIntegrand::evaluate: trial space missing.");
2383 template <
typename TGr
idFunction>
2386 int quadOrder,
const char* subsets)
2388 return GridFunctionDistance2<H1SemiDistIntegrand<TGridFunction>, TGridFunction>
2389 (*spGridFct1, cmp1, *spGridFct2, cmp2, quadOrder, subsets);
2393 template <
typename TGr
idFunction>
2396 int quadOrder,
const char* subsets)
2398 return sqrt(
H1SemiError2(*spGridFct1, cmp1, *spGridFct2, cmp2, quadOrder, subsets));
2402 template <
typename TGr
idFunction>
2407 return H1SemiError(*spGridFct1, cmp1, *spGridFct2, cmp2, quadOrder, NULL);
2411 template <
typename TGr
idFunction>
2413 TGridFunction& spGridFct2,
const char* cmp2,
2414 int quadOrder,
const char* subsets,
2417 return GridFunctionDistance2<H1SemiDistIntegrand<TGridFunction>, TGridFunction>
2418 (spGridFct1, cmp1, spGridFct2, cmp2, quadOrder, subsets, weights);
2422 template <
typename TGr
idFunction>
2424 TGridFunction& spGridFct2,
const char* cmp2,
2425 int quadOrder,
const char* subsets,
2427 {
return sqrt(
H1SemiDistance2(spGridFct1, cmp1, spGridFct2, cmp2, quadOrder, subsets, weights)); }
2430 template <
typename TGr
idFunction>
2432 TGridFunction& spGridFct2,
const char* cmp2,
2434 {
return H1SemiDistance2(spGridFct1, cmp1, spGridFct2, cmp2, quadOrder, NULL, weights); }
2437 template <
typename TGr
idFunction>
2439 TGridFunction& spGridFct2,
const char* cmp2,
2441 {
return sqrt(
H1SemiDistance2(spGridFct1, cmp1, spGridFct2, cmp2, quadOrder, NULL, weights)); }
2451 template <
typename TGr
idFunction>
2453 :
public StdIntegrand<number, TGridFunction::dim, H1EnergyIntegrand<TGridFunction> >
2489 template <
int elemDim>
2500 const TGridFunction &gridFct=
m_scalarData.grid_function();
2503 = ReferenceMappingProvider::get<elemDim, worldDim>(roid, vCornerCoords);
2516 gridFct.indices(pElem, ind);
2523 vCornerCoords, vLocIP, numIP, &uloc, NULL);
2524 }
UG_CATCH_THROW(
"H1EnergyIntegrand: Cannot evaluate weight data.");
2531 }
UG_CATCH_THROW(
"H1EnergyIntegrand: Cannot evaluate weight data.");
2542 LocalFiniteElementProvider::get<elemDim>(roid,
m_scalarData.id());
2545 const size_t num_sh = rTrialSpace.
num_sh();
2548 std::vector<DoFIndex> ind;
2552 UG_COND_THROW(ind.size() != num_sh,
"H1EnergyIntegrand::evaluate: Wrong number of multi-)indices.");
2555 std::vector<MathVector<elemDim> > vLocGradient(num_sh);
2556 for(
size_t ip = 0; ip < numIP; ++ip)
2559 rTrialSpace.
grads(&vLocGradient[0], vLocIP[ip]);
2562 number approxSolIP = 0.0;
2564 for(
size_t sh = 0; sh < num_sh; ++sh)
2570 approxSolIP += valSH * rTrialSpace.
shape(sh, vLocIP[ip]);
2582 CheckGeneralizedInverse<worldDim,elemDim>(vJT[ip], JTInv);
2590 MatVecMult(approxDGradIP, elemWeights[ip], approxGradIP);
2595 UG_CATCH_THROW(
"H1EnergyIntegrand::evaluate: trial space missing.");
2612 template <
typename TGr
idFunction>
2617 const size_t fct = gridFct.fct_id_by_name(cmp);
2620 UG_COND_THROW(fct >= gridFct.num_fct(),
"H1SemiNorm: Function space does not contain"
2621 " a function with name " << cmp <<
".");
2622 if (weights.invalid()) {
2630 template <
typename TGr
idFunction>
2634 return (sqrt(
H1EnergyNorm2(gridFct, cmp, quadOrder, subsets, weights)));
2637 template <
typename TGr
idFunction>
2640 {
return H1EnergyNorm(*spGridFct, cmp, quadOrder, subsets, weights); }
2642 template <
typename TGr
idFunction>
2644 {
return H1EnergyNorm(spGridFct, cmp, quadOrder, NULL); }
2646 template <
typename TGr
idFunction>
2649 {
return H1EnergyNorm(spGridFct, cmp, quadOrder, NULL, weights); }
2655 template <
typename TGr
idFunction>
2657 :
public StdIntegrand<number, TGridFunction::dim, H1EnergyDistIntegrand<TGridFunction> >
2680 TGridFunction& coarseGridFct,
size_t coarseCmp)
2682 m_fineTopLevel(fineGridFct.dof_distribution()->grid_level().level()),
2685 m_spMG(fineGridFct.domain()->grid()),
2689 UG_THROW(
"H1EnergyDistIntegrand: fine and top level inverted.");
2692 UG_THROW(
"H1EnergyDistIntegrand: grid functions defined on different domains.");
2697 TGridFunction& coarseGridFct,
size_t coarseCmp,
2700 m_fineTopLevel(fineGridFct.dof_distribution()->grid_level().level()),
2703 m_spMG(fineGridFct.domain()->grid()),
2707 UG_THROW(
"H1EnergyDistIntegrand: fine and top level inverted.");
2710 UG_THROW(
"H1EnergyDistIntegrand: grid functions defined on different domains.");
2718 UG_THROW(
"H1EnergyDistIntegrand: Grid function component"
2719 <<
m_fineData.fct()<<
" not defined on subset "<<si);
2721 UG_THROW(
"H1EnergyDistIntegrand: Grid function component"
2727 template <
int elemDim>
2736 typedef typename TGridFunction::template dim_traits<elemDim>::grid_base_object Element;
2738 const TGridFunction &fineGridFct =
m_fineData.grid_function();
2739 const TGridFunction &coarseGridFct =
m_coarseData.grid_function();
2744 int parentLevel =
m_spMG->get_level(pCoarseElem);
2746 pCoarseElem =
m_spMG->get_parent(pCoarseElem);
2747 parentLevel =
m_spMG->get_level(pCoarseElem);
2756 std::vector<MathVector<worldDim> > vCornerCoarse;
2761 = ReferenceMappingProvider::get<elemDim, worldDim>(coarseROID, vCornerCoarse);
2763 = ReferenceMappingProvider::get<elemDim, worldDim>(fineROID, vCornerCoords);
2765 std::vector<MathVector<elemDim> > vCoarseLocIP;
2766 vCoarseLocIP.resize(numIP);
2767 for(
size_t ip = 0; ip < vCoarseLocIP.size(); ++ip)
VecSet(vCoarseLocIP[ip], 0.0);
2781 fineGridFct.indices(pFineElem, ind);
2788 vCornerCoords, vFineLocIP, numIP, &u, NULL);
2804 LocalFiniteElementProvider::get<elemDim>(fineROID,
m_fineData.id());
2806 LocalFiniteElementProvider::get<elemDim>(coarseROID,
m_coarseData.id());
2809 std::vector<DoFIndex> vFineMI, vCoarseMI;
2813 std::vector<MathVector<elemDim> > vFineLocGradient(vFineMI.size());
2814 std::vector<MathVector<elemDim> > vCoarseLocGradient(vCoarseMI.size());
2817 for(
size_t ip = 0; ip < numIP; ++ip)
2820 rFineLSFS.
grads(&vFineLocGradient[0], vFineLocIP[ip]);
2821 rCoarseLSFS.
grads(&vCoarseLocGradient[0], vCoarseLocIP[ip]);
2826 for(
size_t sh = 0; sh < vFineMI.size(); ++sh)
2829 fineSolIP += val * rFineLSFS.
shape(sh, vFineLocIP[ip]);
2833 number coarseSolIP = 0.0;
2835 for(
size_t sh = 0; sh < vCoarseMI.size(); ++sh)
2837 const number val =
DoFRef(coarseGridFct, vCoarseMI[sh]);
2838 coarseSolIP += val * rCoarseLSFS.
shape(sh, vCoarseLocIP[ip]);
2848 CheckGeneralizedInverse<worldDim,elemDim>(vJT[ip], fineJTInv);
2852 MatVecMult(fineGradIP, fineJTInv, fineLocTmp);
2854 MatVecMult(fineWorldLocTmp, elemWeights[ip], fineGradIP);
2860 MatVecMult(coarseGradIP, coarseJTInv, coarseLocTmp);
2862 MatVecMult(coarseWorldLocTmp, elemWeights[ip], coarseGradIP);
2865 vValue[ip] =
VecDistanceSq(fineWorldLocTmp, coarseWorldLocTmp);
2870 UG_CATCH_THROW(
"H1EnergyDiffIntegrand::evaluate: trial space missing.");
2876 template <
typename TGr
idFunction>
2878 TGridFunction& spGridFct2,
const char* cmp2,
2879 int quadOrder,
const char* subsets,
2882 return GridFunctionDistance2<H1EnergyDistIntegrand<TGridFunction>, TGridFunction>
2883 (spGridFct1, cmp1, spGridFct2, cmp2, quadOrder, subsets, weights);
2887 template <
typename TGr
idFunction>
2889 TGridFunction& spGridFct2,
const char* cmp2,
2890 int quadOrder,
const char* subsets,
2892 {
return sqrt(
H1EnergyDistance2(spGridFct1, cmp1, spGridFct2, cmp2, quadOrder, subsets, weights)); }
2895 template <
typename TGr
idFunction>
2897 TGridFunction& spGridFct2,
const char* cmp2,
2899 {
return H1EnergyDistance2(spGridFct1, cmp1, spGridFct2, cmp2, quadOrder, NULL, weights); }
2902 template <
typename TGr
idFunction>
2904 TGridFunction& spGridFct2,
const char* cmp2,
2906 {
return sqrt(
H1EnergyDistance2(spGridFct1, cmp1, spGridFct2, cmp2, quadOrder, NULL, weights)); }
2914 template <
typename TGr
idFunction>
2916 :
public StdIntegrand<number, TGridFunction::dim, H1NormIntegrand<TGridFunction> >
2937 UG_THROW(
"H1Norm: Grid function component"
2943 template <
int elemDim>
2956 = ReferenceMappingProvider::get<elemDim, worldDim>(roid, vCornerCoords);
2961 LocalFiniteElementProvider::get<elemDim>(roid,
m_scalarData.id());
2964 const size_t num_sh = rTrialSpace.
num_sh();
2967 std::vector<DoFIndex> ind;
2971 if(ind.size() != num_sh)
2972 UG_THROW(
"H1ErrorIntegrand::evaluate: Wrong number of"
2976 std::vector<MathVector<elemDim> > vLocGradient(num_sh);
2977 for(
size_t ip = 0; ip < numIP; ++ip)
2981 rTrialSpace.
grads(&vLocGradient[0], vLocIP[ip]);
2984 number approxSolIP = 0.0;
2986 for(
size_t sh = 0; sh < num_sh; ++sh)
2992 approxSolIP += valSH * rTrialSpace.
shape(sh, vLocIP[ip]);
3004 CheckGeneralizedInverse<worldDim,elemDim>(vJT[ip], JTInv);
3010 vValue[ip] = approxSolIP * approxSolIP;
3011 vValue[ip] +=
VecDot(approxGradIP, approxGradIP);
3015 UG_CATCH_THROW(
"H1SemiNormFuncIntegrand::evaluate: trial space missing.");
3022 template <
typename TGr
idFunction>
3024 int quadOrder,
const char* subsets=NULL)
3027 const size_t fct = u.fct_id_by_name(cmp);
3030 if(fct >= u.num_fct())
3031 UG_THROW(
"H1Norm: Function space does not contain"
3032 " a function with name " << cmp <<
".");
3039 template <
typename TGr
idFunction>
3041 int quadOrder,
const char* subsets=NULL)
3043 return sqrt(
H1Norm2(u, cmp, quadOrder,subsets));
3046 template <
typename TGr
idFunction>
3048 int quadOrder,
const char* subsets)
3050 return H1Norm(*spGridFct, cmp, quadOrder, subsets);
3053 template <
typename TGr
idFunction>
3056 return H1Norm(*spGridFct, cmp, quadOrder, NULL);
3062 template <
typename TGr
idFunction>
3064 :
public StdIntegrand<number, TGridFunction::dim, H1DistIntegrand<TGridFunction> >
3083 TGridFunction& coarseGridFct,
size_t coarseCmp)
3085 m_fineTopLevel(fineGridFct.dof_distribution()->grid_level().level()),
3088 m_spMG(fineGridFct.domain()->grid())
3091 UG_THROW(
"H1DiffIntegrand: fine and top level inverted.");
3093 if(fineGridFct.domain().get() !=
3094 coarseGridFct.domain().get())
3095 UG_THROW(
"H1DiffIntegrand: grid functions defined on different domains.");
3105 UG_THROW(
"H1DiffIntegrand: Grid function component"
3106 <<
m_fineData.fct()<<
" not defined on subset "<<si);
3108 UG_THROW(
"H1DiffIntegrand: Grid function component"
3114 template <
int elemDim>
3123 typedef typename TGridFunction::template dim_traits<elemDim>::grid_base_object Element;
3128 int parentLevel =
m_spMG->get_level(pCoarseElem);
3130 pCoarseElem =
m_spMG->get_parent(pCoarseElem);
3131 parentLevel =
m_spMG->get_level(pCoarseElem);
3140 std::vector<MathVector<worldDim> > vCornerCoarse;
3145 = ReferenceMappingProvider::get<elemDim, worldDim>(coarseROID, vCornerCoarse);
3147 = ReferenceMappingProvider::get<elemDim, worldDim>(fineROID, vCornerCoords);
3149 std::vector<MathVector<elemDim> > vCoarseLocIP;
3150 vCoarseLocIP.resize(numIP);
3151 for(
size_t ip = 0; ip < vCoarseLocIP.size(); ++ip)
VecSet(vCoarseLocIP[ip], 0.0);
3157 LocalFiniteElementProvider::get<elemDim>(fineROID,
m_fineData.id());
3159 LocalFiniteElementProvider::get<elemDim>(coarseROID,
m_coarseData.id());
3162 std::vector<DoFIndex> vFineMI, vCoarseMI;
3166 std::vector<MathVector<elemDim> > vFineLocGradient(vFineMI.size());
3167 std::vector<MathVector<elemDim> > vCoarseLocGradient(vCoarseMI.size());
3170 for(
size_t ip = 0; ip < numIP; ++ip)
3173 rFineLSFS.
grads(&vFineLocGradient[0], vFineLocIP[ip]);
3174 rCoarseLSFS.
grads(&vCoarseLocGradient[0], vCoarseLocIP[ip]);
3179 for(
size_t sh = 0; sh < vFineMI.size(); ++sh)
3182 fineSolIP += val * rFineLSFS.
shape(sh, vFineLocIP[ip]);
3185 number coarseSolIP = 0.0;
3187 for(
size_t sh = 0; sh < vCoarseMI.size(); ++sh)
3190 coarseSolIP += val * rCoarseLSFS.
shape(sh, vCoarseLocIP[ip]);
3200 CheckGeneralizedInverse<worldDim,elemDim>(vJT[ip], fineJTInv);
3204 MatVecMult(fineGradIP, fineJTInv, fineLocTmp);
3210 MatVecMult(coarseGradIP, coarseJTInv, coarseLocTmp);
3213 vValue[ip] = (coarseSolIP - fineSolIP);
3214 vValue[ip] *= vValue[ip];
3219 UG_CATCH_THROW(
"H1DiffIntegrand::evaluate: trial space missing.");
3225 template <
typename TGr
idFunction>
3227 TGridFunction& spGridFct2,
const char* cmp2,
3228 int quadOrder,
const char* subsets=NULL)
3230 return GridFunctionDistance2<H1DistIntegrand<TGridFunction>, TGridFunction>
3231 (spGridFct1, cmp1, spGridFct2, cmp2, quadOrder, subsets);
3235 template <
typename TGr
idFunction>
3237 TGridFunction& spGridFct2,
const char* cmp2,
3238 int quadOrder,
const char* subsets=NULL)
3240 return sqrt(
H1Distance2(spGridFct1, cmp1, spGridFct2, cmp2, quadOrder, subsets));
3243 template <
typename TGr
idFunction>
3246 int quadOrder,
const char* subsets)
3248 return H1Distance(*spGridFct1, cmp1, *spGridFct2, cmp2, quadOrder, subsets);
3252 template <
typename TGr
idFunction>
3257 return H1Distance(*spGridFct1, cmp1, *spGridFct2, cmp2, quadOrder, NULL);
3265 template <
typename TGr
idFunction>
3267 :
public StdIntegrand<number, TGridFunction::dim, StdFuncIntegrand<TGridFunction> >
3292 UG_THROW(
"L2ErrorIntegrand: Grid function component"
3293 <<
m_fct<<
" not defined on subset "<<si);
3298 template <
int elemDim>
3315 LocalFiniteElementProvider::get<elemDim>(roid, m_id);
3318 const size_t num_sh = rTrialSpace.
num_sh();
3322 std::vector<DoFIndex> ind;
3327 "StdFuncIntegrand::evaluate: Wrong number of multi indices.");
3330 for(
size_t ip = 0; ip < numIP; ++ip)
3334 number approxSolIP = 0.0;
3335 for(
size_t sh = 0; sh < num_sh; ++sh)
3340 approxSolIP += valSH * rTrialSpace.
shape(sh, vLocIP[ip]);
3344 vValue[ip] = approxSolIP;
3349 UG_CATCH_THROW(
"StdFuncIntegrand::evaluate: trial space missing.");
3354 template <
typename TGr
idFunction>
3360 typedef typename TGridFunction::template dim_traits<0>::grid_base_object grid_base_object;
3361 typedef typename TGridFunction::template dim_traits<0>::const_iterator const_iterator;
3368 const_iterator iter = gridFct.template begin<grid_base_object>(si);
3369 const_iterator iterEnd = gridFct.template end<grid_base_object>(si);
3372 for(; iter != iterEnd; ++iter)
3375 grid_base_object* pElem = *iter;
3377 std::vector<DoFIndex> ind;
3378 gridFct.dof_indices(pElem, fct, ind);
3382 for(
size_t sh = 0; sh < ind.size(); ++sh)
3384 value +=
DoFRef(gridFct, ind[sh]);
3396 template <
typename TGr
idFunction>
3401 template <
typename TGr
idFunction>
3403 const char* subsets,
int quadOrder)
3406 const size_t fct = gridFct.fct_id_by_name(cmp);
3409 UG_COND_THROW(fct >= gridFct.num_fct(),
"L2Norm: Function space does not contain"
3410 " a function with name " << cmp <<
".");
3413 SubsetGroup ssGrp(gridFct.domain()->subset_handler());
3418 UG_THROW(
"IntegrateSubsets: Subsets '"<<subsets<<
"' do not have same dimension."
3419 "Can not integrate on subsets of different dimensions.");
3429 bool bOnlyVertex =
true;
3430 for(
size_t s = 0;
s < ssGrp.
size(); ++
s)
3431 if(ssGrp.
dim(
s) != 0) bOnlyVertex =
false;
3436 for(
size_t s = 0;
s < ssGrp.
size(); ++
s)
3455 template <
typename TGr
idFunction>
3457 const char* subsets,
int quadOrder)
3458 {
return Integral(*spGridFct, cmp, subsets, quadOrder); }
3461 template <
typename TGr
idFunction>
3463 const char* subsets)
3465 return Integral(spGridFct, cmp, subsets, 1);
3467 template <
typename TGr
idFunction>
3470 return Integral(spGridFct, cmp, NULL, 1);
3480 template <
int WorldDim,
int dim,
typename TConstIterator>
3482 TConstIterator iterEnd,
3493 TConstIterator iter = iterBegin;
3503 for(
size_t s = 0;
s < bndSSGrp.
size(); ++
s)
3506 const int bndSubset = bndSSGrp[
s];
3514 std::vector<MathVector<WorldDim> > vCorner;
3517 for(; iter != iterEnd; ++iter)
3520 grid_base_object* pElem = *iter;
3527 geo.
update(pElem, &vCorner[0], ish);
3530 "Cannot update Finite Volume Geometry.");
3533 for(
size_t s = 0;
s < bndSSGrp.
size(); ++
s)
3536 const int bndSubset = bndSSGrp[
s];
3540 const std::vector<BF>& vBF = geo.
bf(bndSubset);
3543 for(
size_t b = 0; b < vBF.size(); ++b)
3546 const BF& bf = vBF[b];
3558 integrand.values(&value, &(bf.global_ip()),
3559 pElem, &vCorner[0], &(bf.local_ip()),
3563 UG_CATCH_THROW(
"IntegralNormalComponentOnManifold: Unable to compute values of "
3564 "integrand at integration point.");
3567 integral +=
VecDot(value, bf.normal());
3578 template <
int WorldDim,
int dim,
typename TConstIterator>
3580 TConstIterator iterBegin,
3581 TConstIterator iterEnd,
3594 TConstIterator iter = iterBegin;
3602 std::vector<MathVector<WorldDim> > vCorner;
3603 std::vector<int> vSubsetIndex;
3606 for(; iter != iterEnd; ++iter)
3609 Element* pElem = *iter;
3620 vSubsetIndex.resize(vSide.
size());
3621 for(
size_t i = 0; i < vSide.
size(); ++i)
3625 = ReferenceMappingProvider::get<dim, WorldDim>(elemRoid, vCorner);
3628 = ReferenceElementProvider::get<dim>(elemRoid);
3631 for(
size_t side = 0; side < vSide.
size(); ++side)
3634 if(!bndSSGrp.
contains(vSubsetIndex[side]))
continue;
3637 Side* pSide = vSide[side];
3639 std::vector<MathVector<WorldDim> > vSideCorner(rRefElem.
num(
dim-1, side, 0));
3640 std::vector<MathVector<dim> > vLocalSideCorner(rRefElem.
num(
dim-1, side, 0));
3641 for(
size_t co = 0; co < vSideCorner.size(); ++co){
3642 vSideCorner[co] = vCorner[rRefElem.
id(
dim-1, side, 0, co)];
3643 vLocalSideCorner[co] = rRefElem.
corner(rRefElem.
id(
dim-1, side, 0, co));
3653 ElementNormal<WorldDim>(sideRoid, Normal, &vSideCorner[0]);
3656 const number* vWeight = rSideQuadRule.weights();
3657 const size_t nip = rSideQuadRule.size();
3658 std::vector<MathVector<dim> > vLocalIP(nip);
3659 std::vector<MathVector<dim> > vGlobalIP(nip);
3664 for(
size_t ip = 0; ip < nip; ++ip)
3665 map.local_to_global(vLocalIP[ip], rSideQuadRule.point(ip));
3667 for(
size_t ip = 0; ip < nip; ++ip)
3672 map.jacobian_transposed(&(vJT[0]), rSideQuadRule.points(), nip);
3674 std::vector<MathMatrix<dim, WorldDim> > vElemJT(nip);
3677 std::vector<MathVector<WorldDim> > vValue(nip);
3682 integrand.values(&vValue[0], &vGlobalIP[0],
3683 pElem, &vCorner[0], &vLocalIP[0],
3687 UG_CATCH_THROW(
"IntegralNormalComponentOnManifold: Unable to compute values of "
3688 "integrand at integration point.");
3691 for(
size_t ip = 0; ip < nip; ++ip)
3694 const number weightIP = vWeight[ip];
3700 integral +=
VecDot(vValue[ip], Normal) * weightIP * det;
3709 template <
typename TGr
idFunction,
int dim>
3712 int si,
const SubsetGroup& bndSSGrp,
int quadOrder)
3715 typedef typename TGridFunction::template dim_traits<dim>::grid_base_object grid_base_object;
3716 typedef typename TGridFunction::template dim_traits<dim>::const_iterator const_iterator;
3722 return IntegralNormalComponentOnManifoldUsingFV1Geom<WorldDim,dim,const_iterator>
3723 (spGridFct->template begin<grid_base_object>(si),
3724 spGridFct->template end<grid_base_object>(si),
3725 spGridFct->domain()->position_accessor(),
3726 spGridFct->domain()->subset_handler().
get(),
3727 *spIntegrand, bndSSGrp);
3729 UG_LOG(
" #### IntegralNormalComponentOnManifoldSubset ####:\n")
3730 return IntegralNormalComponentOnManifoldGeneral<WorldDim,dim,const_iterator>
3731 (spGridFct->template begin<grid_base_object>(si),
3732 spGridFct->template end<grid_base_object>(si),
3733 spGridFct->domain()->position_accessor(),
3734 spGridFct->domain()->subset_handler().
get(),
3735 *spIntegrand, bndSSGrp, quadOrder, *spGridFct->domain()->grid());
3739 template <
typename TGr
idFunction>
3743 const char* BndSubsets,
const char* InnerSubsets,
3750 SubsetGroup innerSSGrp(spGridFct->domain()->subset_handler());
3751 if(InnerSubsets != NULL)
3755 UG_THROW(
"IntegralNormalComponentOnManifold: Subsets '"<<InnerSubsets<<
"' do not have same dimension."
3756 "Can not integrate on subsets of different dimensions.");
3766 SubsetGroup bndSSGrp(spGridFct->domain()->subset_handler());
3767 if(BndSubsets != NULL)
3770 UG_THROW(
"IntegralNormalComponentOnManifold: No boundary subsets passed.");
3776 for(
size_t i = 0; i < innerSSGrp.
size(); ++i)
3779 const int si = innerSSGrp[i];
3783 UG_THROW(
"IntegralNormalComponentOnManifold: Dimension of inner subset is "<<
3784 innerSSGrp.
dim(i)<<
", but only World Dimension "<<
dim<<
3785 " subsets can be used for inner subsets.");
3788 switch(innerSSGrp.
dim(i))
3791 case dim: value += IntegralNormalComponentOnManifoldSubset<TGridFunction, dim>(spIntegrand, spGridFct, si, bndSSGrp, quadOrder);
break;
3792 default:
UG_THROW(
"IntegralNormalComponentOnManifold: Dimension "<<innerSSGrp.
dim(i)<<
" not supported. "
3793 " World dimension is "<<
dim<<
".");
3811 template <
typename TGr
idFunction>
3815 const char* BndSubset,
const char* InnerSubset,
3825 template <
typename TGr
idFunction>
3829 const char* BndSubset,
const char* InnerSubset,
3833 template <
typename TGr
idFunction>
3837 const char* BndSubset,
3841 template <
typename TGr
idFunction>
3845 const char* BndSubset,
const char* InnerSubset)
3848 template <
typename TGr
idFunction>
3852 const char* BndSubset)
3860 template <
typename TGr
idFunction>
3863 const char* BndSubset,
const char* InnerSubset,
3864 number time,
int quadOrder)
3868 LuaUserDataFactory<MathVector<dim>,
dim>
::create(luaFct);
3872 template <
typename TGr
idFunction>
3875 const char* BndSubset,
const char* InnerSubset,
3879 template <
typename TGr
idFunction>
3882 const char* BndSubset,
3886 template <
typename TGr
idFunction>
3889 const char* BndSubset,
const char* InnerSubset)
3892 template <
typename TGr
idFunction>
3895 const char* BndSubset)
3914 template <
typename TGr
idFunction>
3916 const char* BndSubset)
3919 const size_t fct = u.fct_id_by_name(cmp);
3922 if(fct >= u.num_fct())
3923 UG_THROW(
"IntegrateNormalComponentOnManifold: Function space does not contain"
3924 " a function with name " << cmp <<
".");
3927 UG_THROW(
"IntegrateNormalComponentOnManifold:"
3928 "Only implemented for Lagrange P1 functions.");
3931 SubsetGroup bndSSGrp(u.domain()->subset_handler());
3938 for(
size_t i = 0; i < bndSSGrp.
size(); ++i)
3941 const int si = bndSSGrp[i];
3944 if(!u.is_def_in_subset(fct, si))
continue;
3953 typedef typename TGridFunction::template dim_traits<dim>::const_iterator const_iterator;
3954 const_iterator iter = u.template begin<grid_base_object>();
3955 const_iterator iterEnd = u.template end<grid_base_object>();
3961 for(
size_t s = 0;
s < bndSSGrp.
size(); ++
s)
3964 const int bndSubset = bndSSGrp[
s];
3972 std::vector<MathVector<dim> > vCorner;
3975 for( ; iter != iterEnd; ++iter)
3978 grid_base_object* elem = *iter;
3985 geo.
update(elem, &vCorner[0], u.domain()->subset_handler().get());
3988 "Cannot update Finite Volume Geometry.");
3991 std::vector<DoFIndex> ind;
3992 u.dof_indices(elem, fct, ind);
3995 for(
size_t s = 0;
s < bndSSGrp.
size(); ++
s)
3998 const int bndSubset = bndSSGrp[
s];
4002 const std::vector<BF>& vBF = geo.
bf(bndSubset);
4005 for(
size_t b = 0; b < vBF.size(); ++b)
4008 const BF& bf = vBF[b];
4015 "IntegrateNormalComponentOnManifold::values: Wrong number of"
4016 " multi indices, ind: "<<ind.size() <<
", bf.num_sh: "
4020 for(
size_t sh = 0; sh < bf.num_sh(); ++sh)
4028 value -=
VecDot(val, normal);
4063 template <
typename TGr
idFunction>
4065 const char* BndSubset,
const char* InnerSubset = NULL)
4068 const size_t fct = u.fct_id_by_name(cmp);
4071 if(fct >= u.num_fct())
4072 UG_THROW(
"IntegrateNormalGradientOnManifold: Function space does not contain"
4073 " a function with name " << cmp <<
".");
4076 UG_THROW(
"IntegrateNormalGradientOnManifold:"
4077 "Only implemented for Lagrange P1 functions.");
4080 SubsetGroup innerSSGrp(u.domain()->subset_handler());
4081 if(InnerSubset != NULL)
4087 SubsetGroup bndSSGrp(u.domain()->subset_handler());
4088 if(InnerSubset != NULL){
4092 UG_THROW(
"IntegrateNormalGradientOnManifold: No boundary subsets specified. Aborting.");
4099 for(
size_t i = 0; i < innerSSGrp.
size(); ++i)
4102 const int si = innerSSGrp[i];
4105 if(!u.is_def_in_subset(fct, si))
continue;
4109 UG_THROW(
"IntegrateNormalGradientOnManifold: Element dimension does not match world dimension!");
4118 typedef typename TGridFunction::template dim_traits<dim>::const_iterator const_iterator;
4119 const_iterator iter = u.template begin<grid_base_object>();
4120 const_iterator iterEnd = u.template end<grid_base_object>();
4126 for(
size_t s = 0;
s < bndSSGrp.
size(); ++
s)
4129 const int bndSubset = bndSSGrp[
s];
4137 std::vector<MathVector<dim> > vCorner;
4140 for( ; iter != iterEnd; ++iter)
4143 grid_base_object* elem = *iter;
4150 geo.
update(elem, &vCorner[0], u.domain()->subset_handler().get());
4153 "Cannot update Finite Volume Geometry.");
4156 std::vector<DoFIndex> ind;
4157 u.dof_indices(elem, fct, ind);
4160 for(
size_t s = 0;
s < bndSSGrp.
size(); ++
s)
4163 const int bndSubset = bndSSGrp[
s];
4167 const std::vector<BF>& vBF = geo.
bf(bndSubset);
4170 for(
size_t b = 0; b < vBF.size(); ++b)
4173 const BF& bf = vBF[b];
4180 "IntegrateNormalGradientOnManifold::values: Wrong number of"
4181 " multi indices, ind: "<<ind.size() <<
", bf.num_sh: "
4186 for(
size_t sh = 0; sh < bf.num_sh(); ++sh)
4190 VecScaleAdd(grad, 1.0, grad, fctVal, bf.global_grad(sh));
4194 value -=
VecDot(grad, normal);
bool valid() const
returns true if the pointer is valid, false if not.
Definition: smart_pointer.h:414
T * get()
returns encapsulated pointer
Definition: smart_pointer.h:197
Definition: pcl_process_communicator.h:70
void allreduce(const void *sendBuf, void *recBuf, int count, DataType type, ReduceOperation op) const
performs MPI_Allreduce on the processes of the communicator.
Definition: pcl_process_communicator.cpp:318
bool valid() const
Definition: attachment_pipe.h:553
constant matrix user data
Definition: const_user_data.h:232
constant scalar user data
Definition: const_user_data.h:153
boundary face
Definition: fv1_geom.h:903
Geometry and shape functions for 1st order Vertex-Centered Finite Volume.
Definition: fv1_geom.h:665
const BF & bf(int si, size_t i) const
returns the boundary face i for subsetIndex
Definition: fv1_geom.h:1135
void update(GridObject *elem, const MathVector< worldDim > *vCornerCoords, const ISubsetHandler *ish=NULL)
update data for given element
Definition: fv1_geom.cpp:669
void add_boundary_subset(int subsetIndex)
add subset that is interpreted as boundary subset.
Definition: fv1_geom.h:1104
const MathVector< dim > & corner(size_t i) const
coordinates of reference corner (i = 0 ... num(0))
Definition: reference_element.h:192
virtual base class for reference mappings
Definition: reference_mapping_provider.h:53
virtual void jacobian_transposed(MathMatrix< dim, worldDim > &JT, const MathVector< dim > &locPos) const =0
returns transposed of jacobian
virtual number jacobian_transposed_inverse(MathMatrix< worldDim, dim > &JTInv, const MathVector< dim > &locPos) const =0
returns transposed of the inverse of the jacobian and returns sqrt of gram determinante
virtual void local_to_global(MathVector< worldDim > &globPos, const MathVector< dim > &locPos) const =0
map local coordinate to global coordinate
virtual void update(const MathVector< worldDim > *vCornerCoord)=0
refresh mapping for new set of corners
virtual void global_to_local(MathVector< dim > &locPos, const MathVector< worldDim > &globPos, const size_t maxIter=1000, const number tol=1e-10) const =0
map global coordinate to local coordinate
the generic attachment-accessor for access to grids attachment pipes.
Definition: grid.h:182
Manages the elements of a grid and their interconnection.
Definition: grid.h:132
void associated_elements_sorted(traits< Vertex >::secure_container &elemsOut, TElem *e)
Puts all elements of type TAss which are contained in 'e' into elemsOut in the reference elements ord...
Definition: grid_impl.hpp:503
The base class for all geometric objects, such as vertices, edges, faces, volumes,...
Definition: grid_base_objects.h:157
virtual ReferenceObjectID reference_object_id() const =0
Integrand for the distance of two grid functions - evaluated in the H1 norm.
Definition: integrate.h:3065
const int m_fineTopLevel
Definition: integrate.h:3072
const int m_coarseTopLevel
Definition: integrate.h:3075
ScalarGridFunctionData< TGridFunction > m_fineData
Definition: integrate.h:3071
SmartPtr< MultiGrid > m_spMG
multigrid
Definition: integrate.h:3078
virtual ~H1DistIntegrand()
DTOR.
Definition: integrate.h:3099
ScalarGridFunctionData< TGridFunction > m_coarseData
Definition: integrate.h:3074
static const int worldDim
world dimension of grid function
Definition: integrate.h:3068
virtual void set_subset(int si)
sets subset
Definition: integrate.h:3102
H1DistIntegrand(TGridFunction &fineGridFct, size_t fineCmp, TGridFunction &coarseGridFct, size_t coarseCmp)
constructor (1 is fine grid function)
Definition: integrate.h:3082
void evaluate(number vValue[], const MathVector< worldDim > vFineGlobIP[], GridObject *pFineElem, const MathVector< worldDim > vCornerCoords[], const MathVector< elemDim > vFineLocIP[], const MathMatrix< elemDim, worldDim > vJT[], const size_t numIP)
returns the values of the integrand for a bunch of ips
Definition: integrate.h:3115
Integrand for the distance of two grid functions - evaluated in the norm .
Definition: integrate.h:2658
ConstSmartPtr< weight_type > m_spWeight
scalar weight (optional)
Definition: integrate.h:2675
static const int worldDim
world dimension of grid function
Definition: integrate.h:2661
SmartPtr< MultiGrid > m_spMG
multigrid
Definition: integrate.h:2672
H1SemiIntegrand< TGridFunction >::weight_type weight_type
Definition: integrate.h:2662
virtual void set_subset(int si)
sets subset
Definition: integrate.h:2715
ScalarGridFunctionData< TGridFunction > m_fineData
Definition: integrate.h:2665
virtual ~H1EnergyDistIntegrand()
Definition: integrate.h:2712
void evaluate(number vValue[], const MathVector< worldDim > vFineGlobIP[], GridObject *pFineElem, const MathVector< worldDim > vCornerCoords[], const MathVector< elemDim > vFineLocIP[], const MathMatrix< elemDim, worldDim > vJT[], const size_t numIP)
returns the values of the integrand for a bunch of ips
Definition: integrate.h:2728
const int m_fineTopLevel
Definition: integrate.h:2666
ScalarGridFunctionData< TGridFunction > m_coarseData
Definition: integrate.h:2668
H1EnergyDistIntegrand(TGridFunction &fineGridFct, size_t fineCmp, TGridFunction &coarseGridFct, size_t coarseCmp, ConstSmartPtr< weight_type > spWeight)
constructor
Definition: integrate.h:2696
H1EnergyDistIntegrand(TGridFunction &fineGridFct, size_t fineCmp, TGridFunction &coarseGridFct, size_t coarseCmp)
constructor
Definition: integrate.h:2679
const int m_coarseTopLevel
Definition: integrate.h:2669
Norm of a grid function, evaluated in (weighted) H1-semi norm.
Definition: integrate.h:2454
ConstSmartPtr< weight_type > m_spWeight
scalar weight (optional)
Definition: integrate.h:2465
virtual void set_subset(int si)
sets subset
Definition: integrate.h:2480
static const int worldDim
world dimension of grid function
Definition: integrate.h:2457
UserData< MathMatrix< worldDim, worldDim >, worldDim > weight_type
Definition: integrate.h:2458
ScalarGridFunctionData< TGridFunction > m_scalarData
grid function data
Definition: integrate.h:2462
virtual ~H1EnergyIntegrand()
DTOR.
Definition: integrate.h:2477
H1EnergyIntegrand(TGridFunction &gridFct, size_t cmp, ConstSmartPtr< weight_type > spWeight)
constructor
Definition: integrate.h:2473
H1EnergyIntegrand(TGridFunction &gridFct, size_t cmp)
constructor
Definition: integrate.h:2469
void evaluate(number vValue[], const MathVector< worldDim > vGlobIP[], GridObject *pElem, const MathVector< worldDim > vCornerCoords[], const MathVector< elemDim > vLocIP[], const MathMatrix< elemDim, worldDim > vJT[], const size_t numIP)
returns the values of the integrand for a bunch of ips
Definition: integrate.h:2490
Definition: integrate.h:1262
virtual void set_subset(int si)
sets subset
Definition: integrate.h:1293
SmartPtr< UserData< MathVector< worldDim >, worldDim > > m_spExactGrad
exact gradient
Definition: integrate.h:1275
H1ErrorIntegrand(SmartPtr< UserData< number, worldDim > > spExactSol, SmartPtr< UserData< MathVector< worldDim >, worldDim > > spExactGrad, TGridFunction &gridFct, size_t cmp, number time)
constructor
Definition: integrate.h:1282
ScalarGridFunctionData< TGridFunction > m_scalarData
grid function
Definition: integrate.h:1269
SmartPtr< UserData< number, worldDim > > m_spExactSolution
exact solution
Definition: integrate.h:1272
static const int worldDim
world dimension of grid function
Definition: integrate.h:1265
void evaluate(number vValue[], const MathVector< worldDim > vGlobIP[], GridObject *pElem, const MathVector< worldDim > vCornerCoords[], const MathVector< elemDim > vLocIP[], const MathMatrix< elemDim, worldDim > vJT[], const size_t numIP)
returns the values of the integrand for a bunch of ips
Definition: integrate.h:1303
number m_time
time
Definition: integrate.h:1278
Definition: integrate.h:2917
void evaluate(number vValue[], const MathVector< worldDim > vGlobIP[], GridObject *pElem, const MathVector< worldDim > vCornerCoords[], const MathVector< elemDim > vLocIP[], const MathMatrix< elemDim, worldDim > vJT[], const size_t numIP)
returns the values of the integrand for a bunch of ips
Definition: integrate.h:2944
ScalarGridFunctionData< TGridFunction > m_scalarData
Definition: integrate.h:2923
virtual ~H1NormIntegrand()
DTOR.
Definition: integrate.h:2931
virtual void set_subset(int si)
sets subset
Definition: integrate.h:2934
static const int worldDim
world dimension of grid function
Definition: integrate.h:2920
H1NormIntegrand(TGridFunction &gridFct, size_t cmp)
CTOR.
Definition: integrate.h:2927
Integrand for the distance of two grid functions - evaluated in the (weighted) H1-semi norm.
Definition: integrate.h:2173
void evaluate(number vValue[], const MathVector< worldDim > vFineGlobIP[], GridObject *pFineElem, const MathVector< worldDim > vCornerCoords[], const MathVector< elemDim > vFineLocIP[], const MathMatrix< elemDim, worldDim > vJT[], const size_t numIP)
returns the values of the integrand for a bunch of ips
Definition: integrate.h:2239
H1SemiDistIntegrand(TGridFunction &fineGridFct, size_t fineCmp, TGridFunction &coarseGridFct, size_t coarseCmp, ConstSmartPtr< weight_type > spWeight)
constructor
Definition: integrate.h:2211
const int m_fineTopLevel
Definition: integrate.h:2181
H1SemiDistIntegrand(TGridFunction &fineGridFct, size_t fineCmp, TGridFunction &coarseGridFct, size_t coarseCmp)
constructor
Definition: integrate.h:2194
ScalarGridFunctionData< TGridFunction > m_fineData
Definition: integrate.h:2180
virtual ~H1SemiDistIntegrand()
Definition: integrate.h:2224
ConstSmartPtr< weight_type > m_spWeight
scalar weight (optional)
Definition: integrate.h:2190
H1SemiIntegrand< TGridFunction >::weight_type weight_type
Definition: integrate.h:2177
virtual void set_subset(int si)
sets subset
Definition: integrate.h:2227
static const int worldDim
world dimension of grid function
Definition: integrate.h:2176
SmartPtr< MultiGrid > m_spMG
multigrid
Definition: integrate.h:2187
ScalarGridFunctionData< TGridFunction > m_coarseData
Definition: integrate.h:2183
const int m_coarseTopLevel
Definition: integrate.h:2184
Norm of a grid function, evaluated in (weighted) H1-semi norm.
Definition: integrate.h:1967
UserData< MathMatrix< worldDim, worldDim >, worldDim > weight_type
Definition: integrate.h:1971
void evaluate(number vValue[], const MathVector< worldDim > vGlobIP[], GridObject *pElem, const MathVector< worldDim > vCornerCoords[], const MathVector< elemDim > vLocIP[], const MathMatrix< elemDim, worldDim > vJT[], const size_t numIP)
returns the values of the integrand for a bunch of ips
Definition: integrate.h:2003
static const int worldDim
world dimension of grid function
Definition: integrate.h:1970
H1SemiIntegrand(TGridFunction &gridFct, size_t cmp, ConstSmartPtr< weight_type > spWeight)
constructor
Definition: integrate.h:1986
ScalarGridFunctionData< TGridFunction > m_scalarData
grid function data
Definition: integrate.h:1975
ConstSmartPtr< weight_type > m_spWeight
scalar weight (optional)
Definition: integrate.h:1978
virtual void set_subset(int si)
sets subset
Definition: integrate.h:1993
H1SemiIntegrand(TGridFunction &gridFct, size_t cmp)
constructor
Definition: integrate.h:1982
virtual ~H1SemiIntegrand()
DTOR.
Definition: integrate.h:1990
Abstract integrand interface.
Definition: integrate.h:121
virtual void values(TData vValue[], const MathVector< worldDim > vGlobIP[], GridObject *pElem, const MathVector< worldDim > vCornerCoords[], const MathVector< 1 > vLocIP[], const MathMatrix< 1, worldDim > vJT[], const size_t numIP)=0
returns the values of the integrand for a bunch of ips
virtual void set_subset(int si)
sets the subset
Definition: integrate.h:168
static const int worldDim
world dimension
Definition: integrate.h:124
int subset() const
returns the subset
Definition: integrate.h:171
virtual void values(TData vValue[], const MathVector< worldDim > vGlobIP[], GridObject *pElem, const MathVector< worldDim > vCornerCoords[], const MathVector< 3 > vLocIP[], const MathMatrix< 3, worldDim > vJT[], const size_t numIP)=0
returns the values of the integrand for a bunch of ips
int m_si
subset
Definition: integrate.h:175
TData data_type
data type
Definition: integrate.h:127
virtual void values(TData vValue[], const MathVector< worldDim > vGlobIP[], GridObject *pElem, const MathVector< worldDim > vCornerCoords[], const MathVector< 2 > vLocIP[], const MathMatrix< 2, worldDim > vJT[], const size_t numIP)=0
returns the values of the integrand for a bunch of ips
virtual ~IIntegrand()
Definition: integrate.h:164
Definition: subset_handler_interface.h:223
int get_subset_index(GridObject *elem) const
Definition: subset_handler_interface.cpp:560
Integrand for the distance of two grid functions - evaluated in the (weighted) H1-semi norm.
Definition: integrate.h:1741
const int m_coarseTopLevel
Definition: integrate.h:1752
void evaluate(number vValue[], const MathVector< worldDim > vFineGlobIP[], GridObject *pFineElem, const MathVector< worldDim > vCornerCoords[], const MathVector< elemDim > vFineLocIP[], const MathMatrix< elemDim, worldDim > vJT[], const size_t numIP)
returns the values of the integrand for a bunch of ips
Definition: integrate.h:1821
virtual ~L2DistIntegrand()
Definition: integrate.h:1807
double m_deltaFineCoarse
shift
Definition: integrate.h:1760
static const int worldDim
world dimension of grid function
Definition: integrate.h:1744
L2DistIntegrand(TGridFunction &fineGridFct, size_t fineCmp, TGridFunction &coarseGridFct, size_t coarseCmp, ConstSmartPtr< weight_type > spWeight)
constructor (1st is fine grid function)
Definition: integrate.h:1779
ConstSmartPtr< weight_type > m_spWeight
Definition: integrate.h:1757
const int m_fineTopLevel
Definition: integrate.h:1749
L2DistIntegrand(TGridFunction &fineGridFct, size_t fineCmp, TGridFunction &coarseGridFct, size_t coarseCmp)
constructor (1st is fine grid function)
Definition: integrate.h:1765
ScalarGridFunctionData< TGridFunction > m_coarseData
Definition: integrate.h:1751
L2DistIntegrand(TGridFunction &fineGridFct, size_t fineCmp, TGridFunction &coarseGridFct, size_t coarseCmp, ConstSmartPtr< weight_type > spWeight, number dist12)
constructor (1st is fine grid function)
Definition: integrate.h:1793
virtual void set_subset(int si)
sets subset
Definition: integrate.h:1810
L2Integrand< TGridFunction >::weight_type weight_type
Definition: integrate.h:1745
SmartPtr< MultiGrid > m_spMG
multigrid
Definition: integrate.h:1755
ScalarGridFunctionData< TGridFunction > m_fineData
Definition: integrate.h:1748
Definition: integrate.h:1073
L2ErrorIntegrand(SmartPtr< UserData< number, worldDim > > spExactSol, TGridFunction &gridFct, size_t cmp, number time)
constructor
Definition: integrate.h:1089
static const int worldDim
world dimension of grid function
Definition: integrate.h:1076
number m_time
time
Definition: integrate.h:1085
ScalarGridFunctionData< TGridFunction > m_scalarData
Definition: integrate.h:1079
SmartPtr< UserData< number, worldDim > > m_spExactSolution
exact solution
Definition: integrate.h:1082
virtual void set_subset(int si)
sets subset
Definition: integrate.h:1099
virtual ~L2ErrorIntegrand()
Definition: integrate.h:1096
void evaluate(number vValue[], const MathVector< worldDim > vGlobIP[], GridObject *pElem, const MathVector< worldDim > vCornerCoords[], const MathVector< elemDim > vLocIP[], const MathMatrix< elemDim, worldDim > vJT[], const size_t numIP)
returns the values of the integrand for a bunch of ips
Definition: integrate.h:1109
Grid function as L2 integrand.
Definition: integrate.h:1574
ScalarGridFunctionData< TGridFunction > m_scalarData
Definition: integrate.h:1582
virtual void set_subset(int si)
sets subset
Definition: integrate.h:1601
UserData< number, worldDim > weight_type
Definition: integrate.h:1578
L2Integrand(TGridFunction &spGridFct, size_t cmp, ConstSmartPtr< weight_type > spWeight)
Definition: integrate.h:1593
virtual ~L2Integrand()
DTOR.
Definition: integrate.h:1598
void evaluate(number vValue[], const MathVector< worldDim > vGlobIP[], GridObject *pElem, const MathVector< worldDim > vCornerCoords[], const MathVector< elemDim > vLocIP[], const MathMatrix< elemDim, worldDim > vJT[], const size_t numIP)
returns the values of the integrand for a bunch of ips
Definition: integrate.h:1610
static const int worldDim
Definition: integrate.h:1577
L2Integrand(TGridFunction &spGridFct, size_t cmp)
CTOR.
Definition: integrate.h:1589
ConstSmartPtr< weight_type > m_spWeight
scalar weight (optional, default is 1.0)
Definition: integrate.h:1585
Identifier for Local Finite Elements.
Definition: local_finite_element_id.h:98
@ LAGRANGE
Definition: local_finite_element_id.h:104
virtual size_t num_sh() const
Definition: local_dof_set.cpp:46
Definition: local_algebra.h:50
virtual base class for local shape function sets
Definition: local_shape_function_set.h:70
virtual void grads(grad_type *vGrad, const MathVector< dim > &x) const =0
returns all gradients evaluated at a point
virtual shape_type shape(size_t i, const MathVector< dim > &x) const =0
evaluates the shape function
Definition: local_algebra.h:198
void resize(const LocalIndices &ind)
resize for current local indices
Definition: local_algebra.h:214
static SmartPtr< LuaUserData< TData, dim, TRet > > create(const std::string &name)
Definition: lua_user_data.h:223
A class for fixed size, dense matrices.
Definition: math_matrix.h:52
Definition: integrate.h:965
ScalarGridFunctionData< TGridFunction > m_scalarData
Definition: integrate.h:971
double max()
Definition: integrate.h:1001
virtual void set_subset(int si)
sets subset
Definition: integrate.h:987
static const int worldDim
world dimension of grid function
Definition: integrate.h:968
MaximumDistIntegrand(TGridFunction &gridFct, size_t cmp)
constructor
Definition: integrate.h:977
void reset()
Definition: integrate.h:994
double m_min
Definition: integrate.h:973
double min()
Definition: integrate.h:1000
void evaluate(number vValue[], const MathVector< worldDim > vGlobIP[], GridObject *pElem, const MathVector< worldDim > vCornerCoords[], const MathVector< elemDim > vLocIP[], const MathMatrix< elemDim, worldDim > vJT[], const size_t numIP)
returns the values of the integrand for a bunch of ips
Definition: integrate.h:1005
double m_max
Definition: integrate.h:973
virtual ~MaximumDistIntegrand()
Definition: integrate.h:984
Container which holds an array of pointers.
Definition: pointer_const_array.h:84
size_t size() const
returns the size of the associated array.
Definition: pointer_const_array_impl.hpp:106
number weight(size_t i) const
return the i'th weight
Definition: quadrature.h:105
const MathVector< dim > * points() const
returns all positions in an array of size()
Definition: quadrature.h:102
size_t size() const
number of integration points
Definition: quadrature.h:92
static const QuadratureRule< TDim > & get(size_t order, QuadType type=BEST)
gets quadrature rule of requested order
Definition: quadrature_provider_impl.h:40
size_t num(int dim) const
returns the number of geometric objects of dim
Definition: reference_element.h:95
int id(int dim_i, size_t i, int dim_j, size_t j) const
id of object j in dimension dim_j of obj i in dimension dim_i
Definition: reference_element.h:127
static DimReferenceMapping< TDim, TWorldDim > & get(ReferenceObjectID roid)
returns a reference to a DimReferenceMapping
Definition: reference_mapping_provider.h:225
Definition: integrate.h:66
TGridFunction::domain_type domain_type
Definition: integrate.h:68
TGridFunction & grid_function()
Definition: integrate.h:75
size_t m_fct
component of function
Definition: integrate.h:106
size_t fct()
Definition: integrate.h:81
TGridFunction & m_gridFct
grid function
Definition: integrate.h:103
ConstSmartPtr< domain_type > domain() const
returns const domain (forward)
Definition: integrate.h:95
ScalarGridFunctionData(TGridFunction &gridFct, size_t cmp)
Definition: integrate.h:70
SmartPtr< domain_type > domain()
returns domain (forward)
Definition: integrate.h:92
size_t dof_indices(TElem *elem, std::vector< DoFIndex > &ind, bool bHang=false, bool bClear=true) const
Definition: integrate.h:98
LFEID m_id
local finite element id
Definition: integrate.h:109
const TGridFunction & grid_function() const
Definition: integrate.h:78
const LFEID & id() const
Definition: integrate.h:84
bool is_def_in_subset(int si) const
returns true, iff scalar function is defined in subset si
Definition: integrate.h:88
Definition: integrate.h:3268
const size_t m_fct
Definition: integrate.h:3278
virtual void set_subset(int si)
sets subset
Definition: integrate.h:3289
TGridFunction * m_pGridFct
Definition: integrate.h:3275
static const int worldDim
Definition: integrate.h:3271
virtual ~StdFuncIntegrand()
Definition: integrate.h:3286
StdFuncIntegrand(TGridFunction *pGridFct, size_t cmp)
constructor
Definition: integrate.h:3282
void evaluate(number vValue[], const MathVector< worldDim > vGlobIP[], GridObject *pElem, const MathVector< worldDim > vCornerCoords[], const MathVector< elemDim > vLocIP[], const MathMatrix< elemDim, worldDim > vJT[], const size_t numIP)
returns the values of the integrand for a bunch of ips
Definition: integrate.h:3299
Abstract integrand interface (using CRTP)
Definition: integrate.h:181
TImpl & getImpl()
access to implementation
Definition: integrate.h:225
virtual void values(TData vValue[], const MathVector< worldDim > vGlobIP[], GridObject *pElem, const MathVector< worldDim > vCornerCoords[], const MathVector< 1 > vLocIP[], const MathMatrix< 1, worldDim > vJT[], const size_t numIP)
returns the values of the integrand for a bunch of ips
Definition: integrate.h:191
virtual void values(TData vValue[], const MathVector< worldDim > vGlobIP[], GridObject *pElem, const MathVector< worldDim > vCornerCoords[], const MathVector< 2 > vLocIP[], const MathMatrix< 2, worldDim > vJT[], const size_t numIP)
returns the values of the integrand for a bunch of ips
Definition: integrate.h:201
static const int worldDim
world dimension
Definition: integrate.h:184
TData data_type
data type
Definition: integrate.h:187
virtual void values(TData vValue[], const MathVector< worldDim > vGlobIP[], GridObject *pElem, const MathVector< worldDim > vCornerCoords[], const MathVector< 3 > vLocIP[], const MathMatrix< 3, worldDim > vJT[], const size_t numIP)
returns the values of the integrand for a bunch of ips
Definition: integrate.h:211
const TImpl & getImpl() const
const access to implementation
Definition: integrate.h:228
Group of subsets.
Definition: subset_group.h:51
size_t size() const
number of subsets in this group
Definition: subset_group.h:122
void add_all()
select all subsets of underlying subset handler
Definition: subset_group.cpp:133
int dim(size_t i) const
dimension of subset
Definition: subset_group.cpp:237
void add(int si)
adds a subset by number to this group
Definition: subset_group.cpp:64
bool contains(int si) const
returns true if subset is contained in this group
Definition: subset_group.cpp:272
For arbitrary UserData and grid functions and , this class (should) define the integrand .
Definition: integrate.h:668
ScalarGridFunctionData< TGridFunction > m_coarseData
Definition: integrate.h:678
number inner_prod(const MathVector< worldDim > &d1, const MathVector< worldDim > &d2)
Definition: integrate.h:827
number inner_dist2(const number &v1, const number &v2)
Definition: integrate.h:836
number inner_prod(const number &d1, const number &d2)
Definition: integrate.h:824
virtual ~UserDataDistIntegrandSq()
Definition: integrate.h:706
ScalarGridFunctionData< TGridFunction > m_fineData
Definition: integrate.h:675
const int m_fineTopLevel
Definition: integrate.h:676
static const int worldDim
world dimension of grid function
Definition: integrate.h:671
SmartPtr< MultiGrid > m_spMG
multigrid
Definition: integrate.h:682
number inner_prod(const T &d1, const T &d2)
Definition: integrate.h:831
number inner_dist2(const MathVector< worldDim > &v1, const MathVector< worldDim > &v2)
Definition: integrate.h:839
UserDataDistIntegrandSq(SmartPtr< UserData< TData, worldDim > > spData, TGridFunction &fineGridFct, size_t fineCmp, TGridFunction &coarseGridFct, size_t coarseCmp)
constructor (1st is fine grid function)
Definition: integrate.h:693
double m_time
Definition: integrate.h:689
const int m_coarseTopLevel
Definition: integrate.h:679
void evaluate(number vValue[], const MathVector< worldDim > vGlobIP[], GridObject *pFineElem, const MathVector< worldDim > vCornerCoords[], const MathVector< elemDim > vFineLocIP[], const MathMatrix< elemDim, worldDim > vJT[], const size_t numIP)
returns the values of the integrand for a bunch of ips
Definition: integrate.h:722
SmartPtr< UserData< TData, worldDim > > m_spData
Definition: integrate.h:686
virtual void set_subset(int si)
sets subset
Definition: integrate.h:709
number inner_dist2(const T &d1, const T &d2)
Definition: integrate.h:843
Type based UserData.
Definition: user_data.h:143
virtual bool requires_grid_fct() const =0
returns if grid function is needed for evaluation
TData data_type
Definition: user_data.h:145
For arbitrary UserData , this class defines the integrand .
Definition: integrate.h:468
UserDataIntegrand(SmartPtr< UserData< TData, worldDim > > spData, number time)
constructor
Definition: integrate.h:497
static const int worldDim
Definition: integrate.h:471
TData data_type
Definition: integrate.h:474
TGridFunction * m_spGridFct
Definition: integrate.h:481
UserDataIntegrand(SmartPtr< UserData< TData, worldDim > > spData, TGridFunction *spGridFct, number time)
constructor
Definition: integrate.h:488
number m_time
Definition: integrate.h:484
SmartPtr< UserData< TData, worldDim > > m_spData
Definition: integrate.h:478
void evaluate(TData vValue[], const MathVector< worldDim > vGlobIP[], GridObject *pElem, const MathVector< worldDim > vCornerCoords[], const MathVector< elemDim > vLocIP[], const MathMatrix< elemDim, worldDim > vJT[], const size_t numIP)
returns the values of the integrand for a bunch of ips
Definition: integrate.h:507
For arbitrary UserData (of type TData), this class defines the integrand .
Definition: integrate.h:557
number inner_prod(const MathVector< worldDim > &d1, const MathVector< worldDim > &d2)
Definition: integrate.h:653
UserDataIntegrandSq(SmartPtr< UserData< TData, worldDim > > spData, const TGridFunction *pGridFct, number time)
constructor
Definition: integrate.h:577
SmartPtr< UserData< TData, worldDim > > m_spData
Definition: integrate.h:567
void evaluate(number vValue[], const MathVector< worldDim > vGlobIP[], GridObject *pElem, const MathVector< worldDim > vCornerCoords[], const MathVector< elemDim > vLocIP[], const MathMatrix< elemDim, worldDim > vJT[], const size_t numIP)
returns the values of the integrand for a bunch of ips
Definition: integrate.h:598
static const int worldDim
Definition: integrate.h:560
TData data_type
Definition: integrate.h:563
number m_time
Definition: integrate.h:573
const TGridFunction * m_pGridFct
Definition: integrate.h:570
number inner_prod(const number &d1, const number &d2)
Definition: integrate.h:650
number inner_prod(const T &d1, const T &d2)
Definition: integrate.h:657
UserDataIntegrandSq(SmartPtr< UserData< TData, worldDim > > spData, number time)
constructor
Definition: integrate.h:586
void CollectCornerCoordinates(std::vector< typename TAAPos::ValueType > &vCornerCoordsOut, const TElem &elem, const TAAPos &aaPos, bool clearContainer=true)
returns the corner coordinates of a geometric object
Definition: domain_util_impl.h:75
MathMatrix< N, M, T >::value_type SqrtGramDeterminant(const MathMatrix< N, M, T > &m)
Square root of Gram Determinant of a matrix.
Definition: math_matrix_functions_common_impl.hpp:508
MathMatrix< N, M, T >::value_type GeneralizedInverse(MathMatrix< N, M, T > &mOut, const MathMatrix< M, N, T > &m)
Definition: math_matrix_functions_common_impl.hpp:751
matrix_t::value_type MatMaxNorm(matrix_t &m)
Definition: math_matrix_functions_common_impl.hpp:1024
MathMatrix< N, M, T >::value_type Inverse(MathMatrix< N, M, T > &mOut, const MathMatrix< M, N, T > &m)
Inverse of a matrix.
Definition: math_matrix_functions_common_impl.hpp:560
void MatSubtract(matrix_t &mOut, const matrix_t &m1, const matrix_t &m2)
subtracts m2 from m1 and stores the result in a mOut
Definition: math_matrix_functions_common_impl.hpp:68
#define PCL_RO_SUM
Definition: pcl_methods.h:63
#define PCL_DT_DOUBLE
Definition: pcl_datatype.h:57
int NumProcs()
returns the number of processes
Definition: pcl_base.cpp:91
const NullSmartPtr SPNULL
The equivalent to NULL for smart pointers.
Definition: smart_pointer.h:90
#define UG_ASSERT(expr, msg)
Definition: assert.h:70
#define UG_CATCH_THROW(msg)
Definition: error.h:64
#define UG_THROW(msg)
Definition: error.h:57
#define UG_LOG(msg)
Definition: log.h:367
#define UG_COND_THROW(cond, msg)
UG_COND_THROW(cond, msg) : performs a UG_THROW(msg) if cond == true.
Definition: error.h:61
double number
Definition: types.h:124
void MatVecMult(vector_t_out &vOut, const matrix_t &m, const vector_t_in &v)
Matrix - Vector Multiplication.
Definition: math_matrix_vector_functions_common_impl.hpp:49
void VecScaleAppend(vector_t &vOut, typename vector_t::value_type s1, const vector_t &v1)
Scales a Vector and adds it to a second vector.
Definition: math_vector_functions_common_impl.hpp:126
void VecSet(vector_t &vInOut, typename vector_t::value_type s)
Set each vector component to scalar (componentwise)
Definition: math_vector_functions_common_impl.hpp:539
void VecScaleAdd(vector_t &vOut, typename vector_t::value_type s1, const vector_t &v1, typename vector_t::value_type s2, const vector_t &v2)
Scales two Vectors, adds them and returns the sum in a third vector.
Definition: math_vector_functions_common_impl.hpp:265
vector_t::value_type VecTwoNormSq(const vector_t &v)
Definition: math_vector_functions_common_impl.hpp:585
vector_t::value_type VecDistanceSq(const vector_t &v1, const vector_t &v2)
returns the squared distance of two vector_ts.
Definition: math_vector_functions_common_impl.hpp:351
vector_t::value_type VecDot(const vector_t &v1, const vector_t &v2)
returns the dot-product of two vector_ts
Definition: math_vector_functions_common_impl.hpp:385
function util LuaCallbackHelper create(func)
Definition: smart_pointer.h:814
int local(bglp_vertex_descriptor p)
Definition: parallel_matrix.h:57
number H1SemiDistance2(TGridFunction &spGridFct1, const char *cmp1, TGridFunction &spGridFct2, const char *cmp2, int quadOrder, const char *subsets, ConstSmartPtr< typename H1SemiDistIntegrand< TGridFunction >::weight_type > weights)
Squared distance in H1 semi norm (with select subsets & weights)
Definition: integrate.h:2412
number H1SemiError2(SmartPtr< TGridFunction > spGridFct1, const char *cmp1, SmartPtr< TGridFunction > spGridFct2, const char *cmp2, int quadOrder, const char *subsets)
Distance in H1 semi norm (with subset selection)
Definition: integrate.h:2384
number IntegrateNormalGradientOnManifold(TGridFunction &u, const char *cmp, const char *BndSubset, const char *InnerSubset=NULL)
Integrates the Flux of a component over some boundary subsets.
Definition: integrate.h:4064
number Integrate(TConstIterator iterBegin, TConstIterator iterEnd, typename domain_traits< WorldDim >::position_accessor_type &aaPos, IIntegrand< number, WorldDim > &integrand, int quadOrder, std::string quadType, Grid::AttachmentAccessor< typename domain_traits< dim >::grid_base_object, ANumber > *paaElemContribs=NULL)
integrates on the whole domain
Definition: integrate.h:260
number L2Distance2(TGridFunction &spGridFct1, const char *cmp1, TGridFunction &spGridFct2, const char *cmp2, int quadOrder, const char *subsets, ConstSmartPtr< typename L2Integrand< TGridFunction >::weight_type > spWeight, number avgDist12=0.0)
computes the squared l2 distance between two functions
Definition: integrate.h:1911
number H1Norm(TGridFunction &u, const char *cmp, int quadOrder, const char *subsets=NULL)
Definition: integrate.h:3040
number H1SemiNorm2(TGridFunction &gridFct, const char *cmp, int quadOrder, const char *subsets=NULL, ConstSmartPtr< typename H1SemiIntegrand< TGridFunction >::weight_type > weights=SPNULL)
compute H1 semi-norm of a function on the whole domain (or on selected subsets)
Definition: integrate.h:2125
QuadType GetQuadratureType(const std::string &name)
returns Identifier from string
Definition: quadrature_provider.cpp:299
ReferenceObjectID
these ids are used to identify the shape of a geometric object.
Definition: grid_base_objects.h:74
number IntegralNormalComponentOnManifoldGeneral(TConstIterator iterBegin, TConstIterator iterEnd, typename domain_traits< WorldDim >::position_accessor_type &aaPos, const ISubsetHandler *ish, IIntegrand< MathVector< WorldDim >, WorldDim > &integrand, const SubsetGroup &bndSSGrp, int quadOrder, Grid &grid)
Definition: integrate.h:3579
number & DoFRef(TMatrix &mat, const DoFIndex &iInd, const DoFIndex &jInd)
Definition: multi_index.h:276
number IntegrateNormalComponentOnManifold(TGridFunction &u, const char *cmp, const char *BndSubset)
Integrates a component over some boundary subsets.
Definition: integrate.h:3915
number L2Norm2(TGridFunction &u, const char *cmp, int quadOrder, const char *subsets, ConstSmartPtr< typename L2Integrand< TGridFunction >::weight_type > spWeight)
Definition: integrate.h:1680
const number SMALL
Definition: math_constants.h:41
number L2Distance(TGridFunction &spGridFct1, const char *cmp1, TGridFunction &spGridFct2, const char *cmp2, int quadOrder, const char *subsets)
computes the l2 distance between two functions
Definition: integrate.h:1933
number H1Error(SmartPtr< UserData< number, TGridFunction::dim > > spExactSol, SmartPtr< UserData< MathVector< TGridFunction::dim >, TGridFunction::dim > > spExactGrad, SmartPtr< TGridFunction > spGridFct, const char *cmp, number time, int quadOrder, const char *subsets)
compute H1 error of a function on the whole domain or on some subsets
Definition: integrate.h:1400
number IntegrateSubsets(IIntegrand< number, TGridFunction::dim > &spIntegrand, TGridFunction &spGridFct, const char *subsets, int quadOrder, std::string quadType=std::string())
Definition: integrate.h:393
number IntegralNormalComponentOnManifoldUsingFV1Geom(TConstIterator iterBegin, TConstIterator iterEnd, typename domain_traits< WorldDim >::position_accessor_type &aaPos, const ISubsetHandler *ish, IIntegrand< MathVector< WorldDim >, WorldDim > &integrand, const SubsetGroup &bndSSGrp)
Definition: integrate.h:3481
number H1SemiDistance(TGridFunction &spGridFct1, const char *cmp1, TGridFunction &spGridFct2, const char *cmp2, int quadOrder, const char *subsets, ConstSmartPtr< typename H1SemiDistIntegrand< TGridFunction >::weight_type > weights)
Distance in H1 semi norm (with select subsets & weights)
Definition: integrate.h:2423
void TokenizeString(const string &str, vector< string > &vToken, const char delimiter)
Definition: string_util.cpp:56
number IntegrateSubset(IIntegrand< number, TGridFunction::dim > &spIntegrand, TGridFunction &spGridFct, int si, int quadOrder, std::string quadType)
Definition: integrate.h:373
number H1EnergyNorm(TGridFunction &gridFct, const char *cmp, int quadOrder, const char *subsets=NULL, ConstSmartPtr< typename H1SemiIntegrand< TGridFunction >::weight_type > weights=SPNULL)
Definition: integrate.h:2631
number H1Distance2(TGridFunction &spGridFct1, const char *cmp1, TGridFunction &spGridFct2, const char *cmp2, int quadOrder, const char *subsets=NULL)
Definition: integrate.h:3226
number IntegralNormalComponentOnManifold(SmartPtr< UserData< MathVector< TGridFunction::dim >, TGridFunction::dim > > spData, SmartPtr< TGridFunction > spGridFct, const char *BndSubset, const char *InnerSubset, number time, int quadOrder)
Definition: integrate.h:3812
bool SameDimensionsInAllSubsets(const SubsetGroup &subsetGroup)
Definition: subset_group.cpp:299
number Minimum(SmartPtr< TGridFunction > spGridFct, const char *cmp, const char *subsets)
Definition: integrate.h:1062
number StdFuncIntegralOnVertex(TGridFunction &gridFct, size_t fct, int si)
Definition: integrate.h:3355
number IntegralNormalComponentOnManifoldSubsets(SmartPtr< IIntegrand< MathVector< TGridFunction::dim >, TGridFunction::dim > > spIntegrand, SmartPtr< TGridFunction > spGridFct, const char *BndSubsets, const char *InnerSubsets, int quadOrder)
Definition: integrate.h:3740
number H1SemiNorm(TGridFunction &gridFct, const char *cmp, int quadOrder, const char *subsets=NULL, ConstSmartPtr< typename H1SemiIntegrand< TGridFunction >::weight_type > weights=SPNULL)
Computes the H1SemiNorm.
Definition: integrate.h:2145
number IntegralNormalComponentOnManifoldSubset(SmartPtr< IIntegrand< MathVector< TGridFunction::dim >, TGridFunction::dim > > spIntegrand, SmartPtr< TGridFunction > spGridFct, int si, const SubsetGroup &bndSSGrp, int quadOrder)
Definition: integrate.h:3710
void GetLocalVector(LocalVector &lvec, const TVector &vec)
Definition: local_algebra.h:739
void RemoveLowerDimSubsets(SubsetGroup &subsetGroup)
Definition: subset_group.cpp:315
number H1Norm2(TGridFunction &u, const char *cmp, int quadOrder, const char *subsets=NULL)
Definition: integrate.h:3023
number L2Error(SmartPtr< UserData< number, TGridFunction::dim > > spExactSol, TGridFunction &gridFct, const char *cmp, number time, int quadOrder, const char *subsets)
computes the l2 error function on the whole domain or on some subsets
Definition: integrate.h:1185
number H1Distance(TGridFunction &spGridFct1, const char *cmp1, TGridFunction &spGridFct2, const char *cmp2, int quadOrder, const char *subsets=NULL)
Definition: integrate.h:3236
number GridFunctionDistance2(TGridFunction &spGridFct1, const char *cmp1, TGridFunction &spGridFct2, const char *cmp2, int quadOrder, const char *subsets)
computes an (abstract) distance between two functions
Definition: integrate.h:1466
number H1SemiError(SmartPtr< TGridFunction > spGridFct1, const char *cmp1, SmartPtr< TGridFunction > spGridFct2, const char *cmp2, int quadOrder, const char *subsets)
Distance in H1 semi norm (with subset selection)
Definition: integrate.h:2394
number H1EnergyDistance(TGridFunction &spGridFct1, const char *cmp1, TGridFunction &spGridFct2, const char *cmp2, int quadOrder, const char *subsets, ConstSmartPtr< typename H1SemiDistIntegrand< TGridFunction >::weight_type > weights)
Distance in H1 semi norm (with select subsets & weights)
Definition: integrate.h:2888
number L2Norm(TGridFunction &u, const char *cmp, int quadOrder, const char *subsets)
Definition: integrate.h:1711
number Integral(SmartPtr< UserData< number, TGridFunction::dim > > spData, TGridFunction &spGridFct, const char *subsets, number time, int quadOrder, std::string quadType)
Definition: integrate.h:856
number H1EnergyDistance2(TGridFunction &spGridFct1, const char *cmp1, TGridFunction &spGridFct2, const char *cmp2, int quadOrder, const char *subsets, ConstSmartPtr< typename H1SemiDistIntegrand< TGridFunction >::weight_type > weights)
Squared distance in H1 semi norm (with select subsets & weights)
Definition: integrate.h:2877
number GetMinimum(TGridFunction &gridFct, const char *cmp, const char *subsets)
Definition: integrate.h:1048
number H1EnergyNorm2(TGridFunction &gridFct, const char *cmp, int quadOrder, const char *subsets=NULL, ConstSmartPtr< typename H1SemiIntegrand< TGridFunction >::weight_type > weights=SPNULL)
compute energy -norm of a function on the whole domain (or on selected subsets)
Definition: integrate.h:2613
@ DIM_SUBSET_EMPTY_GRID
Definition: subset_dim_util.h:92
#define PROFILE_FUNC()
Definition: profiler.h:257
QuadType
types of quadratures
Definition: quadrature_provider.h:41
SmartPtr< T, FreePolicy > make_sp(T *inst)
returns a SmartPtr for the passed raw pointer
Definition: smart_pointer.h:836
Definition: domain_traits.h:53
function ProblemDisc new(problemDesc, dom)