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);
1242 template <
typename TGr
idFunction>
1244 :
public StdIntegrand<number, TGridFunction::dim, H1ErrorIntegrand<TGridFunction> >
1267 TGridFunction& gridFct,
size_t cmp,
1279 UG_THROW(
"H1Error: Grid function component"
1285 template <
int elemDim>
1300 LocalFiniteElementProvider::get<elemDim>(roid,
m_scalarData.id());
1303 const size_t num_sh = rTrialSpace.
num_sh();
1306 std::vector<DoFIndex> ind;
1310 if(ind.size() != num_sh)
1311 UG_THROW(
"H1ErrorIntegrand::evaluate: Wrong number of"
1315 std::vector<MathVector<elemDim> > vLocGradient(num_sh);
1316 for(
size_t ip = 0; ip < numIP; ++ip)
1320 (*m_spExactSolution)(exactSolIP, vGlobIP[ip],
m_time, this->
subset());
1324 (*m_spExactGrad)(exactGradIP, vGlobIP[ip],
m_time, this->
subset());
1327 rTrialSpace.
grads(&vLocGradient[0], vLocIP[ip]);
1330 number approxSolIP = 0.0;
1332 for(
size_t sh = 0; sh < num_sh; ++sh)
1338 approxSolIP += valSH * rTrialSpace.
shape(sh, vLocIP[ip]);
1351 vValue[ip] = (exactSolIP - approxSolIP) * (exactSolIP - approxSolIP);
1356 UG_CATCH_THROW(
"H1ErrorIntegrand::evaluate: trial space missing.");
1374 template <
typename TGr
idFunction>
1378 number time,
int quadOrder,
const char* subsets)
1381 const size_t fct = spGridFct->fct_id_by_name(cmp);
1384 if(fct >= spGridFct->num_fct())
1385 UG_THROW(
"H1Error: Function space does not contain"
1386 " a function with name " << cmp <<
".");
1389 return sqrt(
IntegrateSubsets(spIntegrand, *spGridFct, subsets, quadOrder));
1392 template <
typename TGr
idFunction>
1396 number time,
int quadOrder)
1398 return H1Error(spExactSol, spExactGrad, spGridFct, cmp, time, quadOrder, NULL);
1402 template <
typename TGr
idFunction>
1405 number time,
int quadOrder,
const char* subsets)
1409 =
make_sp(
new LuaUserData<number, dim>(ExactSol));
1411 =
make_sp(
new LuaUserData<MathVector<dim>,
dim>(ExactGrad));
1412 return H1Error(spExactSol, spExactGrad, spGridFct, cmp, time, quadOrder, subsets);
1415 template <
typename TGr
idFunction>
1418 number time,
int quadOrder)
1420 return H1Error(ExactSol, ExactGrad, spGridFct, cmp, time, quadOrder, NULL);
1440 template <
typename TDistIntegrand,
typename TGr
idFunction>
1442 TGridFunction& spGridFct2,
const char* cmp2,
1443 int quadOrder,
const char* subsets)
1446 const size_t fct1 = spGridFct1.fct_id_by_name(cmp1);
1447 const size_t fct2 = spGridFct2.fct_id_by_name(cmp2);
1450 if(fct1 >= spGridFct1.num_fct())
1451 UG_THROW(
"GridFunctionDistance: Function space does not contain"
1452 " a function with name " << cmp1 <<
".");
1453 if(fct2 >= spGridFct2.num_fct())
1454 UG_THROW(
"GridFunctionDistance: Function space does not contain"
1455 " a function with name " << cmp2 <<
".");
1458 const int level1 = spGridFct1.dof_distribution()->grid_level().level();
1459 const int level2 = spGridFct2.dof_distribution()->grid_level().level();
1461 if(level1 > level2){
1463 TDistIntegrand spIntegrand(spGridFct1, fct1, spGridFct2, fct2);
1466 TDistIntegrand spIntegrand(spGridFct2, fct2, spGridFct1, fct1);
1473 template <
typename TDistIntegrand,
typename TGr
idFunction>
1475 TGridFunction& spGridFct2,
const char* cmp2,
1479 const size_t fct1 = spGridFct1.fct_id_by_name(cmp1);
1480 const size_t fct2 = spGridFct2.fct_id_by_name(cmp2);
1483 if(fct1 >= spGridFct1.num_fct())
1484 UG_THROW(
"GridFunctionDistance: Function space does not contain"
1485 " a function with name " << cmp1 <<
".");
1486 if(fct2 >= spGridFct2.num_fct())
1487 UG_THROW(
"GridFunctionDistance: Function space does not contain"
1488 " a function with name " << cmp2 <<
".");
1491 const int level1 = spGridFct1.dof_distribution()->grid_level().level();
1492 const int level2 = spGridFct2.dof_distribution()->grid_level().level();
1495 if(level1 > level2){
1496 TDistIntegrand spIntegrand(spGridFct1, fct1, spGridFct2, fct2, spWeights);
1499 TDistIntegrand spIntegrand(spGridFct2, fct2, spGridFct1, fct1, spWeights);
1506 template <
typename TDistIntegrand,
typename TGr
idFunction>
1508 TGridFunction& spGridFct2,
const char* cmp2,
1509 int quadOrder,
const char* subsets,
1514 const size_t fct1 = spGridFct1.fct_id_by_name(cmp1);
1515 const size_t fct2 = spGridFct2.fct_id_by_name(cmp2);
1518 if(fct1 >= spGridFct1.num_fct())
1519 UG_THROW(
"GridFunctionDistance: Function space does not contain"
1520 " a function with name " << cmp1 <<
".");
1521 if(fct2 >= spGridFct2.num_fct())
1522 UG_THROW(
"GridFunctionDistance: Function space does not contain"
1523 " a function with name " << cmp2 <<
".");
1526 const int level1 = spGridFct1.dof_distribution()->grid_level().level();
1527 const int level2 = spGridFct2.dof_distribution()->grid_level().level();
1530 if(level1 > level2){
1531 TDistIntegrand spIntegrand(spGridFct1, fct1, spGridFct2, fct2, spWeights, distAvg12);
1534 TDistIntegrand spIntegrand(spGridFct2, fct2, spGridFct1, fct1, spWeights, -distAvg12);
1546 template <
typename TGr
idFunction>
1548 :
public StdIntegrand<number, TGridFunction::dim, L2Integrand<TGridFunction> >
1579 UG_THROW(
"L2ErrorIntegrand: Grid function component" <<
m_scalarData.fct() <<
" not defined on subset "<<si);
1584 template <
int elemDim>
1598 std::vector<ipdata_type> locElemWeights(numIP, 1.0);
1605 LocalFiniteElementProvider::get<elemDim>(roid,
m_scalarData.id());
1608 const size_t num_sh = rTrialSpace.
num_sh();
1611 std::vector<DoFIndex> ind;
1615 if(ind.size() != num_sh)
1616 UG_THROW(
"L2Integrand::evaluate: Wrong number of multi indices.");
1619 for(
size_t ip = 0; ip < numIP; ++ip)
1623 number approxSolIP = 0.0;
1624 for(
size_t sh = 0; sh < num_sh; ++sh)
1629 approxSolIP += valSH * rTrialSpace.
shape(sh, vLocIP[ip]);
1633 vValue[ip] = locElemWeights[ip]*approxSolIP*approxSolIP;
1654 template <
typename TGr
idFunction>
1656 int quadOrder,
const char* subsets,
1660 const size_t fct = u.fct_id_by_name(cmp);
1663 UG_COND_THROW(fct >= u.num_fct(),
"L2Norm: Function space does not contain"
1664 " a function with name " << cmp <<
".");
1670 template <
typename TGr
idFunction>
1672 int quadOrder,
const char* subsets)
1675 const size_t fct = u.fct_id_by_name(cmp);
1678 UG_COND_THROW(fct >= u.num_fct(),
"L2Norm: Function space does not contain"
1679 " a function with name " << cmp <<
".");
1685 template <
typename TGr
idFunction>
1687 int quadOrder,
const char* subsets)
1689 return sqrt(
L2Norm2(u, cmp, quadOrder, subsets));
1699 template <
typename TGr
idFunction>
1701 {
return L2Norm(gridFct, cmp, quadOrder, NULL); }
1703 template <
typename TGr
idFunction>
1705 {
return L2Norm(*spGridFct, cmp, quadOrder, subsets); }
1707 template <
typename TGr
idFunction>
1709 {
return L2Norm(spGridFct, cmp, quadOrder, NULL); }
1713 template <
typename TGr
idFunction>
1715 :
public StdIntegrand<number, TGridFunction::dim, L2DistIntegrand<TGridFunction> >
1741 TGridFunction& coarseGridFct,
size_t coarseCmp)
1748 "L2DiffIntegrand: fine and top level inverted.");
1750 "L2DiffIntegrand: grid functions defined on different domains.");
1762 "L2DiffIntegrand: fine and top level inverted.");
1764 "L2DiffIntegrand: grid functions defined on different domains.");
1776 "L2DiffIntegrand: fine and top level inverted.");
1778 "L2DiffIntegrand: grid functions defined on different domains.");
1788 "L2DiffIntegrand: Grid function component" <<
m_fineData.fct()<<
" not defined on subset "<<si);
1790 "L2DiffIntegrand: Grid function component" <<
m_coarseData.fct()<<
" not defined on subset "<<si);
1795 template <
int elemDim>
1804 typedef typename TGridFunction::template dim_traits<elemDim>::grid_base_object Element;
1809 int parentLevel =
m_spMG->get_level(pCoarseElem);
1811 pCoarseElem =
m_spMG->get_parent(pCoarseElem);
1812 parentLevel =
m_spMG->get_level(pCoarseElem);
1821 std::vector<MathVector<worldDim> > vCornerCoarse;
1826 = ReferenceMappingProvider::get<elemDim, worldDim>(coarseROID, vCornerCoarse);
1828 std::vector<MathVector<elemDim> > vCoarseLocIP;
1829 vCoarseLocIP.resize(numIP);
1830 for(
size_t ip = 0; ip < vCoarseLocIP.size(); ++ip)
VecSet(vCoarseLocIP[ip], 0.0);
1835 std::vector<ipdata_type> fineElemWeights(numIP, 1.0);
1842 LocalFiniteElementProvider::get<elemDim>(fineROID,
m_fineData.id());
1844 LocalFiniteElementProvider::get<elemDim>(coarseROID,
m_coarseData.id());
1847 std::vector<DoFIndex> vFineMI, vCoarseMI;
1852 for(
size_t ip = 0; ip < numIP; ++ip)
1856 for(
size_t sh = 0; sh < vFineMI.size(); ++sh)
1862 fineSolIP += val * rFineLSFS.
shape(sh, vFineLocIP[ip]);
1864 number coarseSolIP = 0.0;
1865 for(
size_t sh = 0; sh < vCoarseMI.size(); ++sh)
1871 coarseSolIP += val * rCoarseLSFS.
shape(sh, vCoarseLocIP[ip]);
1879 UG_CATCH_THROW(
"L2DistIntegrand::evaluate: trial space missing.");
1885 template <
typename TGr
idFunction>
1887 TGridFunction& spGridFct2,
const char* cmp2,
1888 int quadOrder,
const char* subsets,
1891 return GridFunctionDistance2<L2DistIntegrand<TGridFunction>, TGridFunction>
1892 (spGridFct1, cmp1, spGridFct2, cmp2, quadOrder, subsets, spWeight, avgDist12);
1897 template <
typename TGr
idFunction>
1899 TGridFunction& spGridFct2,
const char* cmp2,
1900 int quadOrder,
const char* subsets)
1902 return GridFunctionDistance2<L2DistIntegrand<TGridFunction>, TGridFunction>
1903 (spGridFct1, cmp1, spGridFct2, cmp2, quadOrder, subsets);
1907 template <
typename TGr
idFunction>
1909 TGridFunction& spGridFct2,
const char* cmp2,
1910 int quadOrder,
const char* subsets)
1912 return sqrt(
L2Distance2(spGridFct1, cmp1, spGridFct2, cmp2, quadOrder, subsets));
1916 template <
typename TGr
idFunction>
1921 return L2Distance(*spGridFct1, cmp1, *spGridFct2, cmp2, quadOrder, NULL);
1924 template <
typename TGr
idFunction>
1927 int quadOrder,
const char* subsets)
1929 return L2Distance(*spGridFct1, cmp1, *spGridFct2, cmp2, quadOrder, subsets);
1939 template <
typename TGr
idFunction>
1941 :
public StdIntegrand<number, TGridFunction::dim, H1SemiIntegrand<TGridFunction> >
1977 template <
int elemDim>
1988 const TGridFunction &gridFct=
m_scalarData.grid_function();
2001 gridFct.indices(pElem, ind);
2008 vCornerCoords, vLocIP, numIP, &uloc, NULL);
2009 }
UG_CATCH_THROW(
"H1SemiIntegrand: Cannot evaluate weight data.");
2016 }
UG_CATCH_THROW(
"H1SemiIntegrand: Cannot evaluate weight data.");
2027 LocalFiniteElementProvider::get<elemDim>(roid,
m_scalarData.id());
2030 const size_t num_sh = rTrialSpace.
num_sh();
2033 std::vector<DoFIndex> ind;
2037 UG_COND_THROW(ind.size() != num_sh,
"H1SemiNormFuncIntegrand::evaluate: Wrong number of multi-)indices.");
2040 std::vector<MathVector<elemDim> > vLocGradient(num_sh);
2041 for(
size_t ip = 0; ip < numIP; ++ip)
2044 rTrialSpace.
grads(&vLocGradient[0], vLocIP[ip]);
2047 number approxSolIP = 0.0;
2049 for(
size_t sh = 0; sh < num_sh; ++sh)
2055 approxSolIP += valSH * rTrialSpace.
shape(sh, vLocIP[ip]);
2069 MatVecMult(approxDGradIP, elemWeights[ip], approxGradIP);
2070 vValue[ip] =
VecDot(approxDGradIP, approxGradIP);
2074 UG_CATCH_THROW(
"H1SemiIntegrand::evaluate: trial space missing.");
2091 template <
typename TGr
idFunction>
2092 number H1SemiNorm2(TGridFunction& gridFct,
const char* cmp,
int quadOrder,
const char* subsets=NULL,
2096 const size_t fct = gridFct.fct_id_by_name(cmp);
2099 UG_COND_THROW(fct >= gridFct.num_fct(),
"H1SemiNorm: Function space does not contain"
2100 " a function with name " << cmp <<
".");
2101 if (weights.invalid()) {
2111 template <
typename TGr
idFunction>
2112 number H1SemiNorm(TGridFunction& gridFct,
const char* cmp,
int quadOrder,
const char* subsets=NULL,
2115 return (sqrt(
H1SemiNorm2(gridFct, cmp, quadOrder, subsets, weights)));
2119 template <
typename TGr
idFunction>
2121 {
return H1SemiNorm(*spGridFct, cmp, quadOrder, subsets); }
2123 template <
typename TGr
idFunction>
2126 {
return H1SemiNorm(*spGridFct, cmp, quadOrder, subsets, weights); }
2128 template <
typename TGr
idFunction>
2130 {
return H1SemiNorm(*spGridFct, cmp, quadOrder, NULL); }
2132 template <
typename TGr
idFunction>
2135 {
return H1SemiNorm(*spGridFct, cmp, quadOrder, NULL, weights); }
2138 template <
typename TGr
idFunction>
2162 TGridFunction& coarseGridFct,
size_t coarseCmp)
2164 m_fineTopLevel(fineGridFct.dof_distribution()->grid_level().level()),
2167 m_spMG(fineGridFct.domain()->grid()),
2171 UG_THROW(
"H1SemiDiffIntegrand: fine and top level inverted.");
2174 UG_THROW(
"H1SemiDiffIntegrand: grid functions defined on different domains.");
2179 TGridFunction& coarseGridFct,
size_t coarseCmp,
2182 m_fineTopLevel(fineGridFct.dof_distribution()->grid_level().level()),
2185 m_spMG(fineGridFct.domain()->grid()),
2198 <<
m_fineData.fct()<<
" not defined on subset "<<si);
2205 template <
int elemDim>
2214 typedef typename TGridFunction::template dim_traits<elemDim>::grid_base_object Element;
2216 const TGridFunction &fineGridFct =
m_fineData.grid_function();
2217 const TGridFunction &coarseGridFct =
m_coarseData.grid_function();
2222 int parentLevel =
m_spMG->get_level(pCoarseElem);
2224 pCoarseElem =
m_spMG->get_parent(pCoarseElem);
2225 parentLevel =
m_spMG->get_level(pCoarseElem);
2234 std::vector<MathVector<worldDim> > vCornerCoarse;
2239 = ReferenceMappingProvider::get<elemDim, worldDim>(coarseROID, vCornerCoarse);
2241 std::vector<MathVector<elemDim> > vCoarseLocIP;
2242 vCoarseLocIP.resize(numIP);
2243 for(
size_t ip = 0; ip < vCoarseLocIP.size(); ++ip)
VecSet(vCoarseLocIP[ip], 0.0);
2257 fineGridFct.indices(pFineElem, ind);
2264 vCornerCoords, vFineLocIP, numIP, &u, NULL);
2280 LocalFiniteElementProvider::get<elemDim>(fineROID,
m_fineData.id());
2282 LocalFiniteElementProvider::get<elemDim>(coarseROID,
m_coarseData.id());
2285 std::vector<DoFIndex> vFineMI, vCoarseMI;
2289 std::vector<MathVector<elemDim> > vFineLocGradient(vFineMI.size());
2290 std::vector<MathVector<elemDim> > vCoarseLocGradient(vCoarseMI.size());
2293 for(
size_t ip = 0; ip < numIP; ++ip)
2296 rFineLSFS.
grads(&vFineLocGradient[0], vFineLocIP[ip]);
2297 rCoarseLSFS.
grads(&vCoarseLocGradient[0], vCoarseLocIP[ip]);
2302 for(
size_t sh = 0; sh < vFineMI.size(); ++sh)
2305 fineSolIP += val * rFineLSFS.
shape(sh, vFineLocIP[ip]);
2309 number coarseSolIP = 0.0;
2311 for(
size_t sh = 0; sh < vCoarseMI.size(); ++sh)
2313 const number val =
DoFRef(coarseGridFct, vCoarseMI[sh]);
2314 coarseSolIP += val * rCoarseLSFS.
shape(sh, vCoarseLocIP[ip]);
2322 MatVecMult(fineGradIP, fineJTInv, fineLocTmp);
2328 MatVecMult(coarseGradIP, coarseJTInv, coarseLocTmp);
2333 vValue[ip] =
VecDistanceSq(coarseGradIP, fineGradIP, elemWeights[ip]);
2337 UG_CATCH_THROW(
"H1SemiDiffIntegrand::evaluate: trial space missing.");
2343 template <
typename TGr
idFunction>
2346 int quadOrder,
const char* subsets)
2348 return GridFunctionDistance2<H1SemiDistIntegrand<TGridFunction>, TGridFunction>
2349 (*spGridFct1, cmp1, *spGridFct2, cmp2, quadOrder, subsets);
2353 template <
typename TGr
idFunction>
2356 int quadOrder,
const char* subsets)
2358 return sqrt(
H1SemiError2(*spGridFct1, cmp1, *spGridFct2, cmp2, quadOrder, subsets));
2362 template <
typename TGr
idFunction>
2367 return H1SemiError(*spGridFct1, cmp1, *spGridFct2, cmp2, quadOrder, NULL);
2371 template <
typename TGr
idFunction>
2373 TGridFunction& spGridFct2,
const char* cmp2,
2374 int quadOrder,
const char* subsets,
2377 return GridFunctionDistance2<H1SemiDistIntegrand<TGridFunction>, TGridFunction>
2378 (spGridFct1, cmp1, spGridFct2, cmp2, quadOrder, subsets, weights);
2382 template <
typename TGr
idFunction>
2384 TGridFunction& spGridFct2,
const char* cmp2,
2385 int quadOrder,
const char* subsets,
2387 {
return sqrt(
H1SemiDistance2(spGridFct1, cmp1, spGridFct2, cmp2, quadOrder, subsets, weights)); }
2390 template <
typename TGr
idFunction>
2392 TGridFunction& spGridFct2,
const char* cmp2,
2394 {
return H1SemiDistance2(spGridFct1, cmp1, spGridFct2, cmp2, quadOrder, NULL, weights); }
2397 template <
typename TGr
idFunction>
2399 TGridFunction& spGridFct2,
const char* cmp2,
2401 {
return sqrt(
H1SemiDistance2(spGridFct1, cmp1, spGridFct2, cmp2, quadOrder, NULL, weights)); }
2411 template <
typename TGr
idFunction>
2413 :
public StdIntegrand<number, TGridFunction::dim, H1EnergyIntegrand<TGridFunction> >
2449 template <
int elemDim>
2460 const TGridFunction &gridFct=
m_scalarData.grid_function();
2473 gridFct.indices(pElem, ind);
2480 vCornerCoords, vLocIP, numIP, &uloc, NULL);
2481 }
UG_CATCH_THROW(
"H1EnergyIntegrand: Cannot evaluate weight data.");
2488 }
UG_CATCH_THROW(
"H1EnergyIntegrand: Cannot evaluate weight data.");
2499 LocalFiniteElementProvider::get<elemDim>(roid,
m_scalarData.id());
2502 const size_t num_sh = rTrialSpace.
num_sh();
2505 std::vector<DoFIndex> ind;
2509 UG_COND_THROW(ind.size() != num_sh,
"H1EnergyIntegrand::evaluate: Wrong number of multi-)indices.");
2512 std::vector<MathVector<elemDim> > vLocGradient(num_sh);
2513 for(
size_t ip = 0; ip < numIP; ++ip)
2516 rTrialSpace.
grads(&vLocGradient[0], vLocIP[ip]);
2519 number approxSolIP = 0.0;
2521 for(
size_t sh = 0; sh < num_sh; ++sh)
2527 approxSolIP += valSH * rTrialSpace.
shape(sh, vLocIP[ip]);
2541 MatVecMult(approxDGradIP, elemWeights[ip], approxGradIP);
2546 UG_CATCH_THROW(
"H1EnergyIntegrand::evaluate: trial space missing.");
2563 template <
typename TGr
idFunction>
2568 const size_t fct = gridFct.fct_id_by_name(cmp);
2571 UG_COND_THROW(fct >= gridFct.num_fct(),
"H1SemiNorm: Function space does not contain"
2572 " a function with name " << cmp <<
".");
2573 if (weights.invalid()) {
2581 template <
typename TGr
idFunction>
2585 return (sqrt(
H1EnergyNorm2(gridFct, cmp, quadOrder, subsets, weights)));
2588 template <
typename TGr
idFunction>
2591 {
return H1EnergyNorm(*spGridFct, cmp, quadOrder, subsets, weights); }
2593 template <
typename TGr
idFunction>
2595 {
return H1EnergyNorm(spGridFct, cmp, quadOrder, NULL); }
2597 template <
typename TGr
idFunction>
2600 {
return H1EnergyNorm(spGridFct, cmp, quadOrder, NULL, weights); }
2606 template <
typename TGr
idFunction>
2608 :
public StdIntegrand<number, TGridFunction::dim, H1EnergyDistIntegrand<TGridFunction> >
2631 TGridFunction& coarseGridFct,
size_t coarseCmp)
2633 m_fineTopLevel(fineGridFct.dof_distribution()->grid_level().level()),
2636 m_spMG(fineGridFct.domain()->grid()),
2640 UG_THROW(
"H1EnergyDistIntegrand: fine and top level inverted.");
2643 UG_THROW(
"H1EnergyDistIntegrand: grid functions defined on different domains.");
2648 TGridFunction& coarseGridFct,
size_t coarseCmp,
2651 m_fineTopLevel(fineGridFct.dof_distribution()->grid_level().level()),
2654 m_spMG(fineGridFct.domain()->grid()),
2658 UG_THROW(
"H1EnergyDistIntegrand: fine and top level inverted.");
2661 UG_THROW(
"H1EnergyDistIntegrand: grid functions defined on different domains.");
2669 UG_THROW(
"H1EnergyDistIntegrand: Grid function component"
2670 <<
m_fineData.fct()<<
" not defined on subset "<<si);
2672 UG_THROW(
"H1EnergyDistIntegrand: Grid function component"
2678 template <
int elemDim>
2687 typedef typename TGridFunction::template dim_traits<elemDim>::grid_base_object Element;
2689 const TGridFunction &fineGridFct =
m_fineData.grid_function();
2690 const TGridFunction &coarseGridFct =
m_coarseData.grid_function();
2695 int parentLevel =
m_spMG->get_level(pCoarseElem);
2697 pCoarseElem =
m_spMG->get_parent(pCoarseElem);
2698 parentLevel =
m_spMG->get_level(pCoarseElem);
2707 std::vector<MathVector<worldDim> > vCornerCoarse;
2712 = ReferenceMappingProvider::get<elemDim, worldDim>(coarseROID, vCornerCoarse);
2714 std::vector<MathVector<elemDim> > vCoarseLocIP;
2715 vCoarseLocIP.resize(numIP);
2716 for(
size_t ip = 0; ip < vCoarseLocIP.size(); ++ip)
VecSet(vCoarseLocIP[ip], 0.0);
2730 fineGridFct.indices(pFineElem, ind);
2737 vCornerCoords, vFineLocIP, numIP, &u, NULL);
2753 LocalFiniteElementProvider::get<elemDim>(fineROID,
m_fineData.id());
2755 LocalFiniteElementProvider::get<elemDim>(coarseROID,
m_coarseData.id());
2758 std::vector<DoFIndex> vFineMI, vCoarseMI;
2762 std::vector<MathVector<elemDim> > vFineLocGradient(vFineMI.size());
2763 std::vector<MathVector<elemDim> > vCoarseLocGradient(vCoarseMI.size());
2766 for(
size_t ip = 0; ip < numIP; ++ip)
2769 rFineLSFS.
grads(&vFineLocGradient[0], vFineLocIP[ip]);
2770 rCoarseLSFS.
grads(&vCoarseLocGradient[0], vCoarseLocIP[ip]);
2775 for(
size_t sh = 0; sh < vFineMI.size(); ++sh)
2778 fineSolIP += val * rFineLSFS.
shape(sh, vFineLocIP[ip]);
2782 number coarseSolIP = 0.0;
2784 for(
size_t sh = 0; sh < vCoarseMI.size(); ++sh)
2786 const number val =
DoFRef(coarseGridFct, vCoarseMI[sh]);
2787 coarseSolIP += val * rCoarseLSFS.
shape(sh, vCoarseLocIP[ip]);
2795 MatVecMult(fineGradIP, fineJTInv, fineLocTmp);
2796 MatVecMult(fineLocTmp, elemWeights[ip], fineGradIP);
2802 MatVecMult(coarseGradIP, coarseJTInv, coarseLocTmp);
2803 MatVecMult(coarseLocTmp, elemWeights[ip], coarseGradIP);
2811 UG_CATCH_THROW(
"H1EnergyDiffIntegrand::evaluate: trial space missing.");
2817 template <
typename TGr
idFunction>
2819 TGridFunction& spGridFct2,
const char* cmp2,
2820 int quadOrder,
const char* subsets,
2823 return GridFunctionDistance2<H1EnergyDistIntegrand<TGridFunction>, TGridFunction>
2824 (spGridFct1, cmp1, spGridFct2, cmp2, quadOrder, subsets, weights);
2828 template <
typename TGr
idFunction>
2830 TGridFunction& spGridFct2,
const char* cmp2,
2831 int quadOrder,
const char* subsets,
2833 {
return sqrt(
H1EnergyDistance2(spGridFct1, cmp1, spGridFct2, cmp2, quadOrder, subsets, weights)); }
2836 template <
typename TGr
idFunction>
2838 TGridFunction& spGridFct2,
const char* cmp2,
2840 {
return H1EnergyDistance2(spGridFct1, cmp1, spGridFct2, cmp2, quadOrder, NULL, weights); }
2843 template <
typename TGr
idFunction>
2845 TGridFunction& spGridFct2,
const char* cmp2,
2847 {
return sqrt(
H1EnergyDistance2(spGridFct1, cmp1, spGridFct2, cmp2, quadOrder, NULL, weights)); }
2855 template <
typename TGr
idFunction>
2857 :
public StdIntegrand<number, TGridFunction::dim, H1NormIntegrand<TGridFunction> >
2878 UG_THROW(
"H1Norm: Grid function component"
2884 template <
int elemDim>
2899 LocalFiniteElementProvider::get<elemDim>(roid,
m_scalarData.id());
2902 const size_t num_sh = rTrialSpace.
num_sh();
2905 std::vector<DoFIndex> ind;
2909 if(ind.size() != num_sh)
2910 UG_THROW(
"H1ErrorIntegrand::evaluate: Wrong number of"
2914 std::vector<MathVector<elemDim> > vLocGradient(num_sh);
2915 for(
size_t ip = 0; ip < numIP; ++ip)
2919 rTrialSpace.
grads(&vLocGradient[0], vLocIP[ip]);
2922 number approxSolIP = 0.0;
2924 for(
size_t sh = 0; sh < num_sh; ++sh)
2930 approxSolIP += valSH * rTrialSpace.
shape(sh, vLocIP[ip]);
2943 vValue[ip] = approxSolIP * approxSolIP;
2944 vValue[ip] +=
VecDot(approxGradIP, approxGradIP);
2948 UG_CATCH_THROW(
"H1SemiNormFuncIntegrand::evaluate: trial space missing.");
2955 template <
typename TGr
idFunction>
2957 int quadOrder,
const char* subsets=NULL)
2960 const size_t fct = u.fct_id_by_name(cmp);
2963 if(fct >= u.num_fct())
2964 UG_THROW(
"H1Norm: Function space does not contain"
2965 " a function with name " << cmp <<
".");
2972 template <
typename TGr
idFunction>
2974 int quadOrder,
const char* subsets=NULL)
2976 return sqrt(
H1Norm2(u, cmp, quadOrder,subsets));
2979 template <
typename TGr
idFunction>
2981 int quadOrder,
const char* subsets)
2983 return H1Norm(*spGridFct, cmp, quadOrder, subsets);
2986 template <
typename TGr
idFunction>
2989 return H1Norm(*spGridFct, cmp, quadOrder, NULL);
2995 template <
typename TGr
idFunction>
2997 :
public StdIntegrand<number, TGridFunction::dim, H1DistIntegrand<TGridFunction> >
3016 TGridFunction& coarseGridFct,
size_t coarseCmp)
3018 m_fineTopLevel(fineGridFct.dof_distribution()->grid_level().level()),
3021 m_spMG(fineGridFct.domain()->grid())
3024 UG_THROW(
"H1DiffIntegrand: fine and top level inverted.");
3026 if(fineGridFct.domain().get() !=
3027 coarseGridFct.domain().get())
3028 UG_THROW(
"H1DiffIntegrand: grid functions defined on different domains.");
3038 UG_THROW(
"H1DiffIntegrand: Grid function component"
3039 <<
m_fineData.fct()<<
" not defined on subset "<<si);
3041 UG_THROW(
"H1DiffIntegrand: Grid function component"
3047 template <
int elemDim>
3056 typedef typename TGridFunction::template dim_traits<elemDim>::grid_base_object Element;
3061 int parentLevel =
m_spMG->get_level(pCoarseElem);
3063 pCoarseElem =
m_spMG->get_parent(pCoarseElem);
3064 parentLevel =
m_spMG->get_level(pCoarseElem);
3073 std::vector<MathVector<worldDim> > vCornerCoarse;
3078 = ReferenceMappingProvider::get<elemDim, worldDim>(coarseROID, vCornerCoarse);
3080 std::vector<MathVector<elemDim> > vCoarseLocIP;
3081 vCoarseLocIP.resize(numIP);
3082 for(
size_t ip = 0; ip < vCoarseLocIP.size(); ++ip)
VecSet(vCoarseLocIP[ip], 0.0);
3088 LocalFiniteElementProvider::get<elemDim>(fineROID,
m_fineData.id());
3090 LocalFiniteElementProvider::get<elemDim>(coarseROID,
m_coarseData.id());
3093 std::vector<DoFIndex> vFineMI, vCoarseMI;
3097 std::vector<MathVector<elemDim> > vFineLocGradient(vFineMI.size());
3098 std::vector<MathVector<elemDim> > vCoarseLocGradient(vCoarseMI.size());
3101 for(
size_t ip = 0; ip < numIP; ++ip)
3104 rFineLSFS.
grads(&vFineLocGradient[0], vFineLocIP[ip]);
3105 rCoarseLSFS.
grads(&vCoarseLocGradient[0], vCoarseLocIP[ip]);
3110 for(
size_t sh = 0; sh < vFineMI.size(); ++sh)
3113 fineSolIP += val * rFineLSFS.
shape(sh, vFineLocIP[ip]);
3116 number coarseSolIP = 0.0;
3118 for(
size_t sh = 0; sh < vCoarseMI.size(); ++sh)
3121 coarseSolIP += val * rCoarseLSFS.
shape(sh, vCoarseLocIP[ip]);
3129 MatVecMult(fineGradIP, fineJTInv, fineLocTmp);
3135 MatVecMult(coarseGradIP, coarseJTInv, coarseLocTmp);
3138 vValue[ip] = (coarseSolIP - fineSolIP);
3139 vValue[ip] *= vValue[ip];
3144 UG_CATCH_THROW(
"H1DiffIntegrand::evaluate: trial space missing.");
3150 template <
typename TGr
idFunction>
3152 TGridFunction& spGridFct2,
const char* cmp2,
3153 int quadOrder,
const char* subsets=NULL)
3155 return GridFunctionDistance2<H1DistIntegrand<TGridFunction>, TGridFunction>
3156 (spGridFct1, cmp1, spGridFct2, cmp2, quadOrder, subsets);
3160 template <
typename TGr
idFunction>
3162 TGridFunction& spGridFct2,
const char* cmp2,
3163 int quadOrder,
const char* subsets=NULL)
3165 return sqrt(
H1Distance2(spGridFct1, cmp1, spGridFct2, cmp2, quadOrder, subsets));
3168 template <
typename TGr
idFunction>
3171 int quadOrder,
const char* subsets)
3173 return H1Distance(*spGridFct1, cmp1, *spGridFct2, cmp2, quadOrder, subsets);
3177 template <
typename TGr
idFunction>
3182 return H1Distance(*spGridFct1, cmp1, *spGridFct2, cmp2, quadOrder, NULL);
3190 template <
typename TGr
idFunction>
3192 :
public StdIntegrand<number, TGridFunction::dim, StdFuncIntegrand<TGridFunction> >
3217 UG_THROW(
"L2ErrorIntegrand: Grid function component"
3218 <<
m_fct<<
" not defined on subset "<<si);
3223 template <
int elemDim>
3240 LocalFiniteElementProvider::get<elemDim>(roid, m_id);
3243 const size_t num_sh = rTrialSpace.
num_sh();
3247 std::vector<DoFIndex> ind;
3252 "StdFuncIntegrand::evaluate: Wrong number of multi indices.");
3255 for(
size_t ip = 0; ip < numIP; ++ip)
3259 number approxSolIP = 0.0;
3260 for(
size_t sh = 0; sh < num_sh; ++sh)
3265 approxSolIP += valSH * rTrialSpace.
shape(sh, vLocIP[ip]);
3269 vValue[ip] = approxSolIP;
3274 UG_CATCH_THROW(
"StdFuncIntegrand::evaluate: trial space missing.");
3279 template <
typename TGr
idFunction>
3285 typedef typename TGridFunction::template dim_traits<0>::grid_base_object grid_base_object;
3286 typedef typename TGridFunction::template dim_traits<0>::const_iterator const_iterator;
3293 const_iterator iter = gridFct.template begin<grid_base_object>(si);
3294 const_iterator iterEnd = gridFct.template end<grid_base_object>(si);
3297 for(; iter != iterEnd; ++iter)
3300 grid_base_object* pElem = *iter;
3302 std::vector<DoFIndex> ind;
3303 gridFct.dof_indices(pElem, fct, ind);
3307 for(
size_t sh = 0; sh < ind.size(); ++sh)
3309 value +=
DoFRef(gridFct, ind[sh]);
3321 template <
typename TGr
idFunction>
3326 template <
typename TGr
idFunction>
3328 const char* subsets,
int quadOrder)
3331 const size_t fct = gridFct.fct_id_by_name(cmp);
3334 UG_COND_THROW(fct >= gridFct.num_fct(),
"L2Norm: Function space does not contain"
3335 " a function with name " << cmp <<
".");
3338 SubsetGroup ssGrp(gridFct.domain()->subset_handler());
3343 UG_THROW(
"IntegrateSubsets: Subsets '"<<subsets<<
"' do not have same dimension."
3344 "Can not integrate on subsets of different dimensions.");
3354 bool bOnlyVertex =
true;
3355 for(
size_t s = 0;
s < ssGrp.
size(); ++
s)
3356 if(ssGrp.
dim(
s) != 0) bOnlyVertex =
false;
3361 for(
size_t s = 0;
s < ssGrp.
size(); ++
s)
3380 template <
typename TGr
idFunction>
3382 const char* subsets,
int quadOrder)
3383 {
return Integral(*spGridFct, cmp, subsets, quadOrder); }
3386 template <
typename TGr
idFunction>
3388 const char* subsets)
3390 return Integral(spGridFct, cmp, subsets, 1);
3392 template <
typename TGr
idFunction>
3395 return Integral(spGridFct, cmp, NULL, 1);
3405 template <
int WorldDim,
int dim,
typename TConstIterator>
3407 TConstIterator iterEnd,
3418 TConstIterator iter = iterBegin;
3428 for(
size_t s = 0;
s < bndSSGrp.
size(); ++
s)
3431 const int bndSubset = bndSSGrp[
s];
3439 std::vector<MathVector<WorldDim> > vCorner;
3442 for(; iter != iterEnd; ++iter)
3445 grid_base_object* pElem = *iter;
3452 geo.
update(pElem, &vCorner[0], ish);
3455 "Cannot update Finite Volume Geometry.");
3458 for(
size_t s = 0;
s < bndSSGrp.
size(); ++
s)
3461 const int bndSubset = bndSSGrp[
s];
3465 const std::vector<BF>& vBF = geo.
bf(bndSubset);
3468 for(
size_t b = 0; b < vBF.size(); ++b)
3471 const BF& bf = vBF[b];
3483 integrand.values(&value, &(bf.global_ip()),
3484 pElem, &vCorner[0], &(bf.local_ip()),
3488 UG_CATCH_THROW(
"IntegralNormalComponentOnManifold: Unable to compute values of "
3489 "integrand at integration point.");
3492 integral +=
VecDot(value, bf.normal());
3503 template <
int WorldDim,
int dim,
typename TConstIterator>
3505 TConstIterator iterBegin,
3506 TConstIterator iterEnd,
3519 TConstIterator iter = iterBegin;
3527 std::vector<MathVector<WorldDim> > vCorner;
3528 std::vector<int> vSubsetIndex;
3531 for(; iter != iterEnd; ++iter)
3534 Element* pElem = *iter;
3545 vSubsetIndex.resize(vSide.
size());
3546 for(
size_t i = 0; i < vSide.
size(); ++i)
3550 = ReferenceMappingProvider::get<dim, WorldDim>(elemRoid, vCorner);
3553 = ReferenceElementProvider::get<dim>(elemRoid);
3556 for(
size_t side = 0; side < vSide.
size(); ++side)
3559 if(!bndSSGrp.
contains(vSubsetIndex[side]))
continue;
3562 Side* pSide = vSide[side];
3564 std::vector<MathVector<WorldDim> > vSideCorner(rRefElem.
num(
dim-1, side, 0));
3565 std::vector<MathVector<dim> > vLocalSideCorner(rRefElem.
num(
dim-1, side, 0));
3566 for(
size_t co = 0; co < vSideCorner.size(); ++co){
3567 vSideCorner[co] = vCorner[rRefElem.
id(
dim-1, side, 0, co)];
3568 vLocalSideCorner[co] = rRefElem.
corner(rRefElem.
id(
dim-1, side, 0, co));
3578 ElementNormal<WorldDim>(sideRoid, Normal, &vSideCorner[0]);
3581 const number* vWeight = rSideQuadRule.weights();
3582 const size_t nip = rSideQuadRule.size();
3583 std::vector<MathVector<dim> > vLocalIP(nip);
3584 std::vector<MathVector<dim> > vGlobalIP(nip);
3589 for(
size_t ip = 0; ip < nip; ++ip)
3590 map.local_to_global(vLocalIP[ip], rSideQuadRule.point(ip));
3592 for(
size_t ip = 0; ip < nip; ++ip)
3597 map.jacobian_transposed(&(vJT[0]), rSideQuadRule.points(), nip);
3599 std::vector<MathMatrix<dim, WorldDim> > vElemJT(nip);
3602 std::vector<MathVector<WorldDim> > vValue(nip);
3607 integrand.values(&vValue[0], &vGlobalIP[0],
3608 pElem, &vCorner[0], &vLocalIP[0],
3612 UG_CATCH_THROW(
"IntegralNormalComponentOnManifold: Unable to compute values of "
3613 "integrand at integration point.");
3616 for(
size_t ip = 0; ip < nip; ++ip)
3619 const number weightIP = vWeight[ip];
3625 integral +=
VecDot(vValue[ip], Normal) * weightIP * det;
3634 template <
typename TGr
idFunction,
int dim>
3637 int si,
const SubsetGroup& bndSSGrp,
int quadOrder)
3640 typedef typename TGridFunction::template dim_traits<dim>::grid_base_object grid_base_object;
3641 typedef typename TGridFunction::template dim_traits<dim>::const_iterator const_iterator;
3647 return IntegralNormalComponentOnManifoldUsingFV1Geom<WorldDim,dim,const_iterator>
3648 (spGridFct->template begin<grid_base_object>(si),
3649 spGridFct->template end<grid_base_object>(si),
3650 spGridFct->domain()->position_accessor(),
3651 spGridFct->domain()->subset_handler().
get(),
3652 *spIntegrand, bndSSGrp);
3654 UG_LOG(
" #### IntegralNormalComponentOnManifoldSubset ####:\n")
3655 return IntegralNormalComponentOnManifoldGeneral<WorldDim,dim,const_iterator>
3656 (spGridFct->template begin<grid_base_object>(si),
3657 spGridFct->template end<grid_base_object>(si),
3658 spGridFct->domain()->position_accessor(),
3659 spGridFct->domain()->subset_handler().
get(),
3660 *spIntegrand, bndSSGrp, quadOrder, *spGridFct->domain()->grid());
3664 template <
typename TGr
idFunction>
3668 const char* BndSubsets,
const char* InnerSubsets,
3675 SubsetGroup innerSSGrp(spGridFct->domain()->subset_handler());
3676 if(InnerSubsets != NULL)
3680 UG_THROW(
"IntegralNormalComponentOnManifold: Subsets '"<<InnerSubsets<<
"' do not have same dimension."
3681 "Can not integrate on subsets of different dimensions.");
3691 SubsetGroup bndSSGrp(spGridFct->domain()->subset_handler());
3692 if(BndSubsets != NULL)
3695 UG_THROW(
"IntegralNormalComponentOnManifold: No boundary subsets passed.");
3701 for(
size_t i = 0; i < innerSSGrp.
size(); ++i)
3704 const int si = innerSSGrp[i];
3708 UG_THROW(
"IntegralNormalComponentOnManifold: Dimension of inner subset is "<<
3709 innerSSGrp.
dim(i)<<
", but only World Dimension "<<
dim<<
3710 " subsets can be used for inner subsets.");
3713 switch(innerSSGrp.
dim(i))
3716 case dim: value += IntegralNormalComponentOnManifoldSubset<TGridFunction, dim>(spIntegrand, spGridFct, si, bndSSGrp, quadOrder);
break;
3717 default:
UG_THROW(
"IntegralNormalComponentOnManifold: Dimension "<<innerSSGrp.
dim(i)<<
" not supported. "
3718 " World dimension is "<<
dim<<
".");
3736 template <
typename TGr
idFunction>
3740 const char* BndSubset,
const char* InnerSubset,
3750 template <
typename TGr
idFunction>
3754 const char* BndSubset,
const char* InnerSubset,
3758 template <
typename TGr
idFunction>
3762 const char* BndSubset,
3766 template <
typename TGr
idFunction>
3770 const char* BndSubset,
const char* InnerSubset)
3773 template <
typename TGr
idFunction>
3777 const char* BndSubset)
3785 template <
typename TGr
idFunction>
3788 const char* BndSubset,
const char* InnerSubset,
3789 number time,
int quadOrder)
3793 LuaUserDataFactory<MathVector<dim>,
dim>
::create(luaFct);
3797 template <
typename TGr
idFunction>
3800 const char* BndSubset,
const char* InnerSubset,
3804 template <
typename TGr
idFunction>
3807 const char* BndSubset,
3811 template <
typename TGr
idFunction>
3814 const char* BndSubset,
const char* InnerSubset)
3817 template <
typename TGr
idFunction>
3820 const char* BndSubset)
3839 template <
typename TGr
idFunction>
3841 const char* BndSubset)
3844 const size_t fct = u.fct_id_by_name(cmp);
3847 if(fct >= u.num_fct())
3848 UG_THROW(
"IntegrateNormalComponentOnManifold: Function space does not contain"
3849 " a function with name " << cmp <<
".");
3852 UG_THROW(
"IntegrateNormalComponentOnManifold:"
3853 "Only implemented for Lagrange P1 functions.");
3856 SubsetGroup bndSSGrp(u.domain()->subset_handler());
3863 for(
size_t i = 0; i < bndSSGrp.
size(); ++i)
3866 const int si = bndSSGrp[i];
3869 if(!u.is_def_in_subset(fct, si))
continue;
3878 typedef typename TGridFunction::template dim_traits<dim>::const_iterator const_iterator;
3879 const_iterator iter = u.template begin<grid_base_object>();
3880 const_iterator iterEnd = u.template end<grid_base_object>();
3886 for(
size_t s = 0;
s < bndSSGrp.
size(); ++
s)
3889 const int bndSubset = bndSSGrp[
s];
3897 std::vector<MathVector<dim> > vCorner;
3900 for( ; iter != iterEnd; ++iter)
3903 grid_base_object* elem = *iter;
3910 geo.
update(elem, &vCorner[0], u.domain()->subset_handler().get());
3913 "Cannot update Finite Volume Geometry.");
3916 std::vector<DoFIndex> ind;
3917 u.dof_indices(elem, fct, ind);
3920 for(
size_t s = 0;
s < bndSSGrp.
size(); ++
s)
3923 const int bndSubset = bndSSGrp[
s];
3927 const std::vector<BF>& vBF = geo.
bf(bndSubset);
3930 for(
size_t b = 0; b < vBF.size(); ++b)
3933 const BF& bf = vBF[b];
3940 "IntegrateNormalComponentOnManifold::values: Wrong number of"
3941 " multi indices, ind: "<<ind.size() <<
", bf.num_sh: "
3945 for(
size_t sh = 0; sh < bf.num_sh(); ++sh)
3953 value -=
VecDot(val, normal);
3988 template <
typename TGr
idFunction>
3990 const char* BndSubset,
const char* InnerSubset = NULL)
3993 const size_t fct = u.fct_id_by_name(cmp);
3996 if(fct >= u.num_fct())
3997 UG_THROW(
"IntegrateNormalGradientOnManifold: Function space does not contain"
3998 " a function with name " << cmp <<
".");
4001 UG_THROW(
"IntegrateNormalGradientOnManifold:"
4002 "Only implemented for Lagrange P1 functions.");
4005 SubsetGroup innerSSGrp(u.domain()->subset_handler());
4006 if(InnerSubset != NULL)
4012 SubsetGroup bndSSGrp(u.domain()->subset_handler());
4013 if(InnerSubset != NULL){
4017 UG_THROW(
"IntegrateNormalGradientOnManifold: No boundary subsets specified. Aborting.");
4024 for(
size_t i = 0; i < innerSSGrp.
size(); ++i)
4027 const int si = innerSSGrp[i];
4030 if(!u.is_def_in_subset(fct, si))
continue;
4034 UG_THROW(
"IntegrateNormalGradientOnManifold: Element dimension does not match world dimension!");
4043 typedef typename TGridFunction::template dim_traits<dim>::const_iterator const_iterator;
4044 const_iterator iter = u.template begin<grid_base_object>();
4045 const_iterator iterEnd = u.template end<grid_base_object>();
4051 for(
size_t s = 0;
s < bndSSGrp.
size(); ++
s)
4054 const int bndSubset = bndSSGrp[
s];
4062 std::vector<MathVector<dim> > vCorner;
4065 for( ; iter != iterEnd; ++iter)
4068 grid_base_object* elem = *iter;
4075 geo.
update(elem, &vCorner[0], u.domain()->subset_handler().get());
4078 "Cannot update Finite Volume Geometry.");
4081 std::vector<DoFIndex> ind;
4082 u.dof_indices(elem, fct, ind);
4085 for(
size_t s = 0;
s < bndSSGrp.
size(); ++
s)
4088 const int bndSubset = bndSSGrp[
s];
4092 const std::vector<BF>& vBF = geo.
bf(bndSubset);
4095 for(
size_t b = 0; b < vBF.size(); ++b)
4098 const BF& bf = vBF[b];
4105 "IntegrateNormalGradientOnManifold::values: Wrong number of"
4106 " multi indices, ind: "<<ind.size() <<
", bf.num_sh: "
4111 for(
size_t sh = 0; sh < bf.num_sh(); ++sh)
4115 VecScaleAdd(grad, 1.0, grad, fctVal, bf.global_grad(sh));
4119 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:2998
const int m_fineTopLevel
Definition: integrate.h:3005
const int m_coarseTopLevel
Definition: integrate.h:3008
ScalarGridFunctionData< TGridFunction > m_fineData
Definition: integrate.h:3004
SmartPtr< MultiGrid > m_spMG
multigrid
Definition: integrate.h:3011
virtual ~H1DistIntegrand()
DTOR.
Definition: integrate.h:3032
ScalarGridFunctionData< TGridFunction > m_coarseData
Definition: integrate.h:3007
static const int worldDim
world dimension of grid function
Definition: integrate.h:3001
virtual void set_subset(int si)
sets subset
Definition: integrate.h:3035
H1DistIntegrand(TGridFunction &fineGridFct, size_t fineCmp, TGridFunction &coarseGridFct, size_t coarseCmp)
constructor (1 is fine grid function)
Definition: integrate.h:3015
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:3048
Integrand for the distance of two grid functions - evaluated in the norm .
Definition: integrate.h:2609
ConstSmartPtr< weight_type > m_spWeight
scalar weight (optional)
Definition: integrate.h:2626
static const int worldDim
world dimension of grid function
Definition: integrate.h:2612
SmartPtr< MultiGrid > m_spMG
multigrid
Definition: integrate.h:2623
H1SemiIntegrand< TGridFunction >::weight_type weight_type
Definition: integrate.h:2613
virtual void set_subset(int si)
sets subset
Definition: integrate.h:2666
ScalarGridFunctionData< TGridFunction > m_fineData
Definition: integrate.h:2616
virtual ~H1EnergyDistIntegrand()
Definition: integrate.h:2663
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:2679
const int m_fineTopLevel
Definition: integrate.h:2617
ScalarGridFunctionData< TGridFunction > m_coarseData
Definition: integrate.h:2619
H1EnergyDistIntegrand(TGridFunction &fineGridFct, size_t fineCmp, TGridFunction &coarseGridFct, size_t coarseCmp, ConstSmartPtr< weight_type > spWeight)
constructor
Definition: integrate.h:2647
H1EnergyDistIntegrand(TGridFunction &fineGridFct, size_t fineCmp, TGridFunction &coarseGridFct, size_t coarseCmp)
constructor
Definition: integrate.h:2630
const int m_coarseTopLevel
Definition: integrate.h:2620
Norm of a grid function, evaluated in (weighted) H1-semi norm.
Definition: integrate.h:2414
ConstSmartPtr< weight_type > m_spWeight
scalar weight (optional)
Definition: integrate.h:2425
virtual void set_subset(int si)
sets subset
Definition: integrate.h:2440
static const int worldDim
world dimension of grid function
Definition: integrate.h:2417
UserData< MathMatrix< worldDim, worldDim >, worldDim > weight_type
Definition: integrate.h:2418
ScalarGridFunctionData< TGridFunction > m_scalarData
grid function data
Definition: integrate.h:2422
virtual ~H1EnergyIntegrand()
DTOR.
Definition: integrate.h:2437
H1EnergyIntegrand(TGridFunction &gridFct, size_t cmp, ConstSmartPtr< weight_type > spWeight)
constructor
Definition: integrate.h:2433
H1EnergyIntegrand(TGridFunction &gridFct, size_t cmp)
constructor
Definition: integrate.h:2429
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:2450
Definition: integrate.h:1245
virtual void set_subset(int si)
sets subset
Definition: integrate.h:1276
SmartPtr< UserData< MathVector< worldDim >, worldDim > > m_spExactGrad
exact gradient
Definition: integrate.h:1258
H1ErrorIntegrand(SmartPtr< UserData< number, worldDim > > spExactSol, SmartPtr< UserData< MathVector< worldDim >, worldDim > > spExactGrad, TGridFunction &gridFct, size_t cmp, number time)
constructor
Definition: integrate.h:1265
ScalarGridFunctionData< TGridFunction > m_scalarData
grid function
Definition: integrate.h:1252
SmartPtr< UserData< number, worldDim > > m_spExactSolution
exact solution
Definition: integrate.h:1255
static const int worldDim
world dimension of grid function
Definition: integrate.h:1248
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:1286
number m_time
time
Definition: integrate.h:1261
Definition: integrate.h:2858
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:2885
ScalarGridFunctionData< TGridFunction > m_scalarData
Definition: integrate.h:2864
virtual ~H1NormIntegrand()
DTOR.
Definition: integrate.h:2872
virtual void set_subset(int si)
sets subset
Definition: integrate.h:2875
static const int worldDim
world dimension of grid function
Definition: integrate.h:2861
H1NormIntegrand(TGridFunction &gridFct, size_t cmp)
CTOR.
Definition: integrate.h:2868
Integrand for the distance of two grid functions - evaluated in the (weighted) H1-semi norm.
Definition: integrate.h:2140
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:2206
H1SemiDistIntegrand(TGridFunction &fineGridFct, size_t fineCmp, TGridFunction &coarseGridFct, size_t coarseCmp, ConstSmartPtr< weight_type > spWeight)
constructor
Definition: integrate.h:2178
const int m_fineTopLevel
Definition: integrate.h:2148
H1SemiDistIntegrand(TGridFunction &fineGridFct, size_t fineCmp, TGridFunction &coarseGridFct, size_t coarseCmp)
constructor
Definition: integrate.h:2161
ScalarGridFunctionData< TGridFunction > m_fineData
Definition: integrate.h:2147
virtual ~H1SemiDistIntegrand()
Definition: integrate.h:2191
ConstSmartPtr< weight_type > m_spWeight
scalar weight (optional)
Definition: integrate.h:2157
H1SemiIntegrand< TGridFunction >::weight_type weight_type
Definition: integrate.h:2144
virtual void set_subset(int si)
sets subset
Definition: integrate.h:2194
static const int worldDim
world dimension of grid function
Definition: integrate.h:2143
SmartPtr< MultiGrid > m_spMG
multigrid
Definition: integrate.h:2154
ScalarGridFunctionData< TGridFunction > m_coarseData
Definition: integrate.h:2150
const int m_coarseTopLevel
Definition: integrate.h:2151
Norm of a grid function, evaluated in (weighted) H1-semi norm.
Definition: integrate.h:1942
UserData< MathMatrix< worldDim, worldDim >, worldDim > weight_type
Definition: integrate.h:1946
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:1978
static const int worldDim
world dimension of grid function
Definition: integrate.h:1945
H1SemiIntegrand(TGridFunction &gridFct, size_t cmp, ConstSmartPtr< weight_type > spWeight)
constructor
Definition: integrate.h:1961
ScalarGridFunctionData< TGridFunction > m_scalarData
grid function data
Definition: integrate.h:1950
ConstSmartPtr< weight_type > m_spWeight
scalar weight (optional)
Definition: integrate.h:1953
virtual void set_subset(int si)
sets subset
Definition: integrate.h:1968
H1SemiIntegrand(TGridFunction &gridFct, size_t cmp)
constructor
Definition: integrate.h:1957
virtual ~H1SemiIntegrand()
DTOR.
Definition: integrate.h:1965
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:1716
const int m_coarseTopLevel
Definition: integrate.h:1727
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:1796
virtual ~L2DistIntegrand()
Definition: integrate.h:1782
double m_deltaFineCoarse
shift
Definition: integrate.h:1735
static const int worldDim
world dimension of grid function
Definition: integrate.h:1719
L2DistIntegrand(TGridFunction &fineGridFct, size_t fineCmp, TGridFunction &coarseGridFct, size_t coarseCmp, ConstSmartPtr< weight_type > spWeight)
constructor (1st is fine grid function)
Definition: integrate.h:1754
ConstSmartPtr< weight_type > m_spWeight
Definition: integrate.h:1732
const int m_fineTopLevel
Definition: integrate.h:1724
L2DistIntegrand(TGridFunction &fineGridFct, size_t fineCmp, TGridFunction &coarseGridFct, size_t coarseCmp)
constructor (1st is fine grid function)
Definition: integrate.h:1740
ScalarGridFunctionData< TGridFunction > m_coarseData
Definition: integrate.h:1726
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:1768
virtual void set_subset(int si)
sets subset
Definition: integrate.h:1785
L2Integrand< TGridFunction >::weight_type weight_type
Definition: integrate.h:1720
SmartPtr< MultiGrid > m_spMG
multigrid
Definition: integrate.h:1730
ScalarGridFunctionData< TGridFunction > m_fineData
Definition: integrate.h:1723
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:1549
ScalarGridFunctionData< TGridFunction > m_scalarData
Definition: integrate.h:1557
virtual void set_subset(int si)
sets subset
Definition: integrate.h:1576
UserData< number, worldDim > weight_type
Definition: integrate.h:1553
L2Integrand(TGridFunction &spGridFct, size_t cmp, ConstSmartPtr< weight_type > spWeight)
Definition: integrate.h:1568
virtual ~L2Integrand()
DTOR.
Definition: integrate.h:1573
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:1585
static const int worldDim
Definition: integrate.h:1552
L2Integrand(TGridFunction &spGridFct, size_t cmp)
CTOR.
Definition: integrate.h:1564
ConstSmartPtr< weight_type > m_spWeight
scalar weight (optional, default is 1.0)
Definition: integrate.h:1560
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:3193
const size_t m_fct
Definition: integrate.h:3203
virtual void set_subset(int si)
sets subset
Definition: integrate.h:3214
TGridFunction * m_pGridFct
Definition: integrate.h:3200
static const int worldDim
Definition: integrate.h:3196
virtual ~StdFuncIntegrand()
Definition: integrate.h:3211
StdFuncIntegrand(TGridFunction *pGridFct, size_t cmp)
constructor
Definition: integrate.h:3207
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:3224
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 RightInverse(MathMatrix< N, M, T > &mOut, const MathMatrix< M, N, T > &m)
Right-Inverse of a Matrix.
Definition: math_matrix_functions_common_impl.hpp:680
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:561
#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:2372
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:2344
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:3989
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:1886
number H1Norm(TGridFunction &u, const char *cmp, int quadOrder, const char *subsets=NULL)
Definition: integrate.h:2973
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:2092
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:3504
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:3840
number L2Norm2(TGridFunction &u, const char *cmp, int quadOrder, const char *subsets, ConstSmartPtr< typename L2Integrand< TGridFunction >::weight_type > spWeight)
Definition: integrate.h:1655
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:1908
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:1375
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:3406
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:2383
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:2582
number H1Distance2(TGridFunction &spGridFct1, const char *cmp1, TGridFunction &spGridFct2, const char *cmp2, int quadOrder, const char *subsets=NULL)
Definition: integrate.h:3151
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:3737
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:3280
number IntegralNormalComponentOnManifoldSubsets(SmartPtr< IIntegrand< MathVector< TGridFunction::dim >, TGridFunction::dim > > spIntegrand, SmartPtr< TGridFunction > spGridFct, const char *BndSubsets, const char *InnerSubsets, int quadOrder)
Definition: integrate.h:3665
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:2112
number IntegralNormalComponentOnManifoldSubset(SmartPtr< IIntegrand< MathVector< TGridFunction::dim >, TGridFunction::dim > > spIntegrand, SmartPtr< TGridFunction > spGridFct, int si, const SubsetGroup &bndSSGrp, int quadOrder)
Definition: integrate.h:3635
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:2956
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:3161
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:1441
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:2354
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:2829
number L2Norm(TGridFunction &u, const char *cmp, int quadOrder, const char *subsets)
Definition: integrate.h:1686
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:2818
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:2564
@ 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)