33 #ifndef __H__UG__LIB_DISC__SPATIAL_DISC__ELEM_DISC__ELEM_DISC_ASSEMBLE_UTIL__
34 #define __H__UG__LIB_DISC__SPATIAL_DISC__ELEM_DISC__ELEM_DISC_ASSEMBLE_UTIL__
44 #include "../../reference_element/reference_element.h"
51 #define PROFILE_ELEM_LOOP
52 #ifdef PROFILE_ELEM_LOOP
53 #define EL_PROFILE_FUNC() PROFILE_FUNC()
54 #define EL_PROFILE_BEGIN(name) PROFILE_BEGIN(name)
55 #define EL_PROFILE_END() PROFILE_END()
57 #define EL_PROFILE_FUNC()
58 #define EL_PROFILE_BEGIN(name)
59 #define EL_PROFILE_END()
76 template <
typename TDomain,
typename TAlgebra>
112 template <
typename TElem,
typename TIterator>
119 int si,
bool bNonRegularGrid,
125 if(iterBegin == iterEnd)
return;
136 vElemDisc, dd->function_pattern(), bNonRegularGrid);
139 Eval.prepare_elem_loop(
id, si);
145 for(TIterator iter = iterBegin; iter != iterEnd; ++iter)
154 if(!spAssTuner->element_used(elem))
continue;
157 dd->indices(elem, ind,
Eval.use_hanging());
168 Eval.prepare_elem(locU, elem,
id, vCornerCoords, ind,
true);
170 UG_CATCH_THROW(
"AssembleStiffnessMatrix Cannot prepare element.");
176 Eval.add_jac_A_elem(locA, locU, elem, vCornerCoords);
178 UG_CATCH_THROW(
"AssembleStiffnessMatrix: Cannot compute Jacobian (A).");
182 spAssTuner->add_local_mat_to_global(A,locA,dd);
184 UG_CATCH_THROW(
"AssembleStiffnessMatrix: Cannot add local matrix.");
190 Eval.finish_elem_loop();
192 UG_CATCH_THROW(
"AssembleStiffnessMatrix: Cannot finish element loop.");
195 UG_CATCH_THROW(
"AssembleStiffnessMatrix': Cannot create Data Evaluator.");
219 template <
typename TElem,
typename TIterator>
226 int si,
bool bNonRegularGrid,
232 if(iterBegin == iterEnd)
return;
244 vElemDisc, dd->function_pattern(), bNonRegularGrid);
247 Eval.prepare_elem_loop(
id, si);
253 for(TIterator iter = iterBegin; iter != iterEnd; ++iter)
262 if(!spAssTuner->element_used(elem))
continue;
265 dd->indices(elem, ind,
Eval.use_hanging());
276 Eval.prepare_elem(locU, elem,
id, vCornerCoords, ind,
true);
284 Eval.add_jac_M_elem(locM, locU, elem, vCornerCoords);
286 UG_CATCH_THROW(
"AssembleMassMatrix: Cannot compute Jacobian (M).");
290 spAssTuner->add_local_mat_to_global(M, locM, dd);
298 Eval.finish_elem_loop();
300 UG_CATCH_THROW(
"AssembleMassMatrix: Cannot finish element loop.");
303 UG_CATCH_THROW(
"AssembleMassMatrix: Cannot create Data Evaluator.");
326 template <
typename TElem,
typename TIterator>
333 int si,
bool bNonRegularGrid,
339 if(iterBegin == iterEnd)
return;
351 vElemDisc, dd->function_pattern(), bNonRegularGrid);
354 Eval.prepare_elem_loop(
id, si);
360 for(TIterator iter = iterBegin; iter != iterEnd; ++iter)
369 if(!spAssTuner->element_used(elem))
continue;
372 dd->indices(elem, ind,
Eval.use_hanging());
383 Eval.prepare_elem(locU, elem,
id, vCornerCoords, ind,
true);
385 UG_CATCH_THROW(
"(stationary) AssembleJacobian: Cannot prepare element.");
393 Eval.add_jac_A_elem(locJ, locU, elem, vCornerCoords);
395 UG_CATCH_THROW(
"(stationary) AssembleJacobian: Cannot compute Jacobian (A).");
399 spAssTuner->add_local_mat_to_global(J, locJ, dd);
401 UG_CATCH_THROW(
"(stationary) AssembleJacobian: Cannot add local matrix.");
407 Eval.finish_elem_loop();
409 UG_CATCH_THROW(
"(stationary) AssembleJacobian: Cannot finish element loop.");
412 UG_CATCH_THROW(
"(stationary) AssembleJacobian: Cannot create Data Evaluator.");
438 template <
typename TElem,
typename TIterator>
445 int si,
bool bNonRegularGrid,
452 if(iterBegin == iterEnd)
return;
471 vElemDisc, dd->function_pattern(), bNonRegularGrid,
473 Eval.set_time_point(0);
476 Eval.prepare_elem_loop(
id, si);
483 for(TIterator iter = iterBegin; iter != iterEnd; ++iter)
492 if(!spAssTuner->element_used(elem))
continue;
495 dd->indices(elem, ind,
Eval.use_hanging());
504 if(
Eval.time_series_needed())
510 Eval.prepare_elem(locU, elem,
id, vCornerCoords, ind,
true);
512 UG_CATCH_THROW(
"(instationary) AssembleJacobian: Cannot prepare element.");
526 UG_CATCH_THROW(
"(instationary) AssembleJacobian: Cannot compute Jacobian (A).");
534 UG_CATCH_THROW(
"(instationary) AssembleJacobian: Cannot compute Jacobian (M).");
538 spAssTuner->add_local_mat_to_global(J, locJ, dd);
540 UG_CATCH_THROW(
"(instationary) AssembleJacobian: Cannot add local matrix.");
548 Eval.finish_elem_loop();
550 UG_CATCH_THROW(
"(instationary) AssembleJacobian: Cannot finish element loop.");
553 UG_CATCH_THROW(
"(instationary) AssembleJacobian: Cannot create Data Evaluator.");
577 template <
typename TElem,
typename TIterator>
584 int si,
bool bNonRegularGrid,
590 if(iterBegin == iterEnd)
return;
602 vElemDisc, dd->function_pattern(), bNonRegularGrid);
605 Eval.prepare_elem_loop(
id, si);
611 for(TIterator iter = iterBegin; iter != iterEnd; ++iter)
620 if(!spAssTuner->element_used(elem))
continue;
623 dd->indices(elem, ind,
Eval.use_hanging());
634 Eval.prepare_elem(locU, elem,
id, vCornerCoords, ind);
636 UG_CATCH_THROW(
"(stationary) AssembleDefect: Cannot prepare element.");
640 if( spAssTuner->modify_solution_enabled() )
644 spAssTuner->modify_LocalSol(modLocU, locU, dd);
657 Eval.add_def_A_elem(locD, locU, elem, vCornerCoords);
659 UG_CATCH_THROW(
"(stationary) AssembleDefect: Cannot compute Defect (A).");
665 Eval.add_rhs_elem(tmpLocD, elem, vCornerCoords);
669 UG_CATCH_THROW(
"(stationary) AssembleDefect: Cannot compute Rhs.");
673 spAssTuner->add_local_vec_to_global(d, locD, dd);
675 UG_CATCH_THROW(
"(stationary) AssembleDefect: Cannot add local vector.");
681 Eval.finish_elem_loop();
683 UG_CATCH_THROW(
"(stationary) AssembleDefect: Cannot finish element loop.");
686 UG_CATCH_THROW(
"(stationary) AssembleDefect: Cannot create Data Evaluator.");
712 template <
typename TElem,
typename TIterator>
719 int si,
bool bNonRegularGrid,
722 const std::vector<number>& vScaleMass,
723 const std::vector<number>& vScaleStiff,
727 if(iterBegin == iterEnd)
return;
736 if(vScaleMass.size() != vScaleStiff.size())
737 UG_THROW(
"(instationary) AssembleDefect: s_a and s_m must have same size.");
739 if(vSol->size() < vScaleStiff.size())
740 UG_THROW(
"(instationary) AssembleDefect: Time stepping scheme needs at "
741 "least "<<vScaleStiff.size()<<
" time steps, but only "<<
742 vSol->size() <<
" passed.");
752 vElemDisc, dd->function_pattern(), bNonRegularGrid,
753 &locTimeSeries, &vScaleMass, &vScaleStiff);
756 Eval.prepare_elem_loop(
id, si);
762 for(TIterator iter = iterBegin; iter != iterEnd; ++iter)
771 if(!spAssTuner->element_used(elem))
continue;
774 dd->indices(elem, ind,
Eval.use_hanging());
786 for(
size_t t = 0; t < vScaleStiff.size(); ++t)
788 number scale_stiff = vScaleStiff[t];
792 Eval.set_time_point(t);
797 Eval.prepare_elem(locU, elem,
id, vCornerCoords, ind,
false);
799 UG_CATCH_THROW(
"(instationary) AssembleDefect: Cannot prepare element.");
808 UG_CATCH_THROW(
"(instationary) AssembleDefect: Cannot compute Defect (M).");
813 if(scale_stiff != 0.0)
823 UG_CATCH_THROW(
"(instationary) AssembleDefect: Cannot compute Defect (A).");
834 UG_CATCH_THROW(
"(instationary) AssembleDefect explizit: Cannot compute Defect (A).");
837 const number dt = vSol->time(0)-vSol->time(1);
845 if(scale_stiff != 0.0)
859 UG_CATCH_THROW(
"(instationary) AssembleDefect: Cannot compute Rhs.");
864 spAssTuner->add_local_vec_to_global(d, locD, dd);
866 UG_CATCH_THROW(
"(instationary) AssembleDefect: Cannot add local vector.");
872 Eval.finish_elem_loop();
874 UG_CATCH_THROW(
"(instationary) AssembleDefect: Cannot finish element loop.");
877 UG_CATCH_THROW(
"(instationary) AssembleDefect: Cannot create Data Evaluator.");
902 template <
typename TElem,
typename TIterator>
909 int si,
bool bNonRegularGrid,
915 if(iterBegin == iterEnd)
return;
927 vElemDisc, dd->function_pattern(), bNonRegularGrid);
932 Eval.prepare_elem_loop(
id, si);
940 for(TIterator iter = iterBegin; iter != iterEnd; ++iter)
949 if(!spAssTuner->element_used(elem))
continue;
952 dd->indices(elem, ind,
Eval.use_hanging());
961 for(
int i = 0; i < 8; ++i)
962 UG_DLOG(
DID_ELEM_DISC_ASSEMBLE_UTIL, 2,
">>OCT_DISC_DEBUG: " <<
"elem_disc_assemble_util.h: " <<
"AssembleLinear(): prepare_elem(): " <<
"vCornerCoords " << i <<
": " << vCornerCoords[i] << std::endl);
964 Eval.prepare_elem(locRhs, elem,
id, vCornerCoords, ind,
true);
966 UG_CATCH_THROW(
"(stationary) AssembleLinear: Cannot prepare element.");
975 Eval.add_jac_A_elem(locA, locRhs, elem, vCornerCoords);
977 UG_CATCH_THROW(
"(stationary) AssembleLinear: Cannot compute Jacobian (A).");
982 Eval.add_rhs_elem(locRhs, elem, vCornerCoords);
984 UG_CATCH_THROW(
"(stationary) AssembleLinear: Cannot compute Rhs.");
988 spAssTuner->add_local_mat_to_global(A, locA, dd);
989 spAssTuner->add_local_vec_to_global(rhs, locRhs, dd);
991 UG_CATCH_THROW(
"(stationary) AssembleLinear: Cannot add local vector/matrix.");
997 Eval.finish_elem_loop();
999 UG_CATCH_THROW(
"(stationary) AssembleLinear: Cannot finish element loop.");
1002 UG_CATCH_THROW(
"(stationary) AssembleLinear: Cannot create Data Evaluator.");
1030 template <
typename TElem,
typename TIterator>
1035 TIterator iterBegin,
1037 int si,
bool bNonRegularGrid,
1041 const std::vector<number>& vScaleMass,
1042 const std::vector<number>& vScaleStiff,
1046 if(iterBegin == iterEnd)
return;
1055 if(vScaleMass.size() != vScaleStiff.size())
1056 UG_THROW(
"(instationary) AssembleLinear: s_a and s_m must have same size.");
1058 if(vSol->size() < vScaleStiff.size())
1059 UG_THROW(
"(instationary) AssembleLinear: Time stepping scheme needs at "
1060 "least "<<vScaleStiff.size()<<
" time steps, but only "<<
1061 vSol->size() <<
" passed.");
1071 vElemDisc, dd->function_pattern(), bNonRegularGrid,
1072 &locTimeSeries, &vScaleMass, &vScaleStiff);
1075 Eval.prepare_elem_loop(
id, si);
1081 for(TIterator iter = iterBegin; iter != iterEnd; ++iter)
1084 TElem* elem = *iter;
1090 if(!spAssTuner->element_used(elem))
continue;
1093 dd->indices(elem, ind,
Eval.use_hanging());
1101 Eval.set_time_point(0);
1104 locA = 0.0; locRhs = 0.0;
1115 Eval.prepare_elem(locU, elem,
id, vCornerCoords, ind,
true);
1117 UG_CATCH_THROW(
"(instationary) AssembleLinear: Cannot prepare element.");
1119 if (!spAssTuner->matrix_is_const())
1128 UG_CATCH_THROW(
"(instationary) AssembleLinear: Cannot compute Jacobian (M).");
1133 if (vScaleStiff[0] != 0.0)
1141 UG_CATCH_THROW(
"(instationary) AssembleLinear: Cannot compute Jacobian (A).");
1146 if (vScaleStiff[0] != 0.0)
1154 UG_CATCH_THROW(
"(instationary) AssembleLinear: Cannot compute Rhs.");
1160 for(
size_t t = 1; t < vScaleStiff.size(); ++t)
1164 Eval.set_time_point(t);
1165 number scaleStiff = vScaleStiff[t];
1170 Eval.prepare_elem(locU, elem,
id, vCornerCoords, ind,
false);
1172 UG_CATCH_THROW(
"(instationary) AssembleLinear: Cannot prepare element.");
1181 UG_CATCH_THROW(
"(instationary) AssembleLinear: Cannot compute Jacobian (M).");
1186 if (scaleStiff != 0.0)
1193 UG_CATCH_THROW(
"(instationary) AssembleLinear: Cannot compute Jacobian (A).");
1198 if (scaleStiff != 0.0)
1205 UG_CATCH_THROW(
"(instationary) AssembleLinear: Cannot compute Rhs.");
1210 if (!spAssTuner->matrix_is_const())
1211 spAssTuner->add_local_mat_to_global(A, locA, dd);
1212 spAssTuner->add_local_vec_to_global(rhs, locRhs, dd);
1214 UG_CATCH_THROW(
"(instationary) AssembleLinear: Cannot add local vector/matrix.");
1220 Eval.finish_elem_loop();
1222 UG_CATCH_THROW(
"(instationary) AssembleLinear: Cannot finish element loop.");
1225 UG_CATCH_THROW(
"(instationary) AssembleLinear: Cannot create Data Evaluator.");
1249 template <
typename TElem,
typename TIterator>
1254 TIterator iterBegin,
1256 int si,
bool bNonRegularGrid,
1262 if(iterBegin == iterEnd)
return;
1274 vElemDisc, dd->function_pattern(), bNonRegularGrid);
1277 Eval.prepare_elem_loop(
id, si);
1283 for(TIterator iter = iterBegin; iter != iterEnd; ++iter)
1286 TElem* elem = *iter;
1292 if(!spAssTuner->element_used(elem))
continue;
1295 dd->indices(elem, ind,
Eval.use_hanging());
1306 Eval.prepare_elem(locU, elem,
id, vCornerCoords, ind);
1316 Eval.add_rhs_elem(locRhs, elem, vCornerCoords);
1322 spAssTuner->add_local_vec_to_global(rhs, locRhs, dd);
1330 Eval.finish_elem_loop();
1361 template <
typename TElem,
typename TIterator>
1366 TIterator iterBegin,
1368 int si,
bool bNonRegularGrid,
1371 const std::vector<number>& vScaleMass,
1372 const std::vector<number>& vScaleStiff,
1376 if(iterBegin == iterEnd)
return;
1385 if(vScaleMass.size() != vScaleStiff.size())
1386 UG_THROW(
"(instationary) AssembleRhs: s_a and s_m must have same size.");
1388 if(vSol->size() < vScaleStiff.size())
1389 UG_THROW(
"(instationary) AssembleRhs: Time stepping scheme needs at "
1390 "least "<<vScaleStiff.size()<<
" time steps, but only "<<
1391 vSol->size() <<
" passed.");
1401 vElemDisc, dd->function_pattern(), bNonRegularGrid,
1402 &locTimeSeries, &vScaleMass, &vScaleStiff);
1405 Eval.prepare_elem_loop(
id, si);
1411 for(TIterator iter = iterBegin; iter != iterEnd; ++iter)
1414 TElem* elem = *iter;
1420 if(!spAssTuner->element_used(elem))
continue;
1423 dd->indices(elem, ind,
Eval.use_hanging());
1430 Eval.set_time_point(0);
1444 Eval.prepare_elem(locU, elem,
id, vCornerCoords, ind,
false);
1446 UG_CATCH_THROW(
"(instationary) AssembleRhs: Cannot prepare element.");
1457 UG_CATCH_THROW(
"(instationary) AssembleRhs: Cannot compute Rhs.");
1463 for(
size_t t = 1; t < vScaleStiff.size(); ++t)
1467 Eval.set_time_point(t);
1472 Eval.prepare_elem(locU, elem,
id, vCornerCoords, ind,
false);
1474 UG_CATCH_THROW(
"(instationary) AssembleRhs: Cannot prepare element.");
1483 UG_CATCH_THROW(
"(instationary) AssembleRhs: Cannot compute Jacobian (M).");
1492 UG_CATCH_THROW(
"(instationary) AssembleRhs: Cannot compute Jacobian (A).");
1501 UG_CATCH_THROW(
"(instationary) AssembleRhs: Cannot compute Rhs.");
1506 spAssTuner->add_local_vec_to_global(rhs, locRhs, dd);
1508 UG_CATCH_THROW(
"(instationary) AssembleRhs: Cannot add local vector.");
1514 Eval.finish_elem_loop();
1516 UG_CATCH_THROW(
"(instationary) AssembleRhs: Cannot finish element loop.");
1519 UG_CATCH_THROW(
"(instationary) AssembleRhs: Cannot create Data Evaluator.");
1542 bool bNonRegularGrid,
1558 vElemDisc, dd->function_pattern(), bNonRegularGrid,
1560 Eval.set_time_point(0);
1567 Eval.prepare_timestep(future_time, vSol->time(0), &vp, algebra_index);
1569 UG_CATCH_THROW(
"(instationary) PrepareTimestep: Cannot prepare timestep.");
1572 UG_CATCH_THROW(
"(instationary) PrepareTimestep: Cannot create Data Evaluator.");
1595 template <
typename TElem,
typename TIterator>
1600 TIterator iterBegin,
1602 int si,
bool bNonRegularGrid,
1607 if(iterBegin == iterEnd)
return;
1625 vElemDisc, dd->function_pattern(), bNonRegularGrid,
1627 Eval.set_time_point(0);
1630 Eval.prepare_elem_loop(
id, si);
1636 for(TIterator iter = iterBegin; iter != iterEnd; ++iter)
1639 TElem* elem = *iter;
1645 if(!spAssTuner->element_used(elem))
continue;
1648 dd->indices(elem, ind,
Eval.use_hanging());
1657 if(
Eval.time_series_needed())
1663 Eval.prepare_timestep_elem(vSol->time(0), locU, elem, vCornerCoords);
1665 UG_CATCH_THROW(
"(instationary) PrepareTimestep: Cannot prepare timestep.");
1671 Eval.finish_elem_loop();
1673 UG_CATCH_THROW(
"AssembleMassMatrix: Cannot finish element loop.");
1676 UG_CATCH_THROW(
"(instationary) PrepareTimestep: Cannot create Data Evaluator.");
1699 bool bNonRegularGrid,
1714 vElemDisc, dd->function_pattern(), bNonRegularGrid,
1716 Eval.set_time_point(0);
1723 Eval.finish_timestep(vSol->time(0), &vp, algebra_index);
1725 UG_CATCH_THROW(
"(instationary) FinishTimestep: Cannot prepare time step.");
1728 UG_CATCH_THROW(
"(instationary) FinishTimestep: Cannot create Data Evaluator.");
1751 template <
typename TElem,
typename TIterator>
1756 TIterator iterBegin,
1758 int si,
bool bNonRegularGrid,
1763 if(iterBegin == iterEnd)
return;
1782 vElemDisc, dd->function_pattern(), bNonRegularGrid,
1784 Eval.set_time_point(0);
1787 Eval.prepare_elem_loop(
id, si);
1793 for(TIterator iter = iterBegin; iter != iterEnd; ++iter)
1796 TElem* elem = *iter;
1802 if(!spAssTuner->element_used(elem))
continue;
1805 dd->indices(elem, ind,
Eval.use_hanging());
1814 if(
Eval.time_series_needed())
1820 Eval.finish_timestep_elem(locTimeSeries.
time(0), locU, elem, vCornerCoords);
1822 UG_CATCH_THROW(
"(instationary) FinishTimestepElem: Cannot finish timestep.");
1828 Eval.finish_elem_loop();
1830 UG_CATCH_THROW(
"AssembleMassMatrix: Cannot finish element loop.");
1833 UG_CATCH_THROW(
"(instationary) FinishTimestepElem: Cannot create Data Evaluator");
1855 template <
typename TElem,
typename TIterator>
1859 TIterator iterBegin,
1861 int si,
bool bNonRegularGrid,
bool bAsTimeDependent)
1864 if(iterBegin == iterEnd)
return;
1876 vElemDisc, dd->function_pattern(), bNonRegularGrid,
1877 bAsTimeDependent? &locTimeSeries : NULL);
1878 Eval.set_time_point(0);
1881 Eval.prepare_elem_loop(
id, si);
1885 Eval.finish_elem_loop();
1910 template <
typename TElem,
typename TIterator>
1917 TIterator iterBegin,
1920 bool bNonRegularGrid,
1925 if(iterBegin == iterEnd)
return;
1937 vElemDisc, dd->function_pattern(), bNonRegularGrid);
1940 Eval.prepare_err_est_elem_loop(
id, si);
1946 for(TIterator iter = iterBegin; iter != iterEnd; ++iter)
1949 TElem* elem = *iter;
1955 dd->indices(elem, ind,
Eval.use_hanging());
1966 Eval.prepare_err_est_elem(locU, elem, vCornerCoords, ind,
false);
1968 UG_CATCH_THROW(
"(stationary) AssembleRhs: Cannot prepare element.");
1973 Eval.compute_err_est_A_elem(locU, elem, vCornerCoords, ind);
1975 UG_CATCH_THROW(
"AssembleErrorEstimator: Cannot assemble the error estimator for stiffness part.");
1980 Eval.compute_err_est_rhs_elem(elem, vCornerCoords, ind);
1982 UG_CATCH_THROW(
"AssembleErrorEstimator: Cannot assemble the error estimator for stiffness part.");
1989 Eval.finish_err_est_elem_loop();
1991 UG_CATCH_THROW(
"AssembleErrorEstimator: Cannot finish element loop.");
1994 UG_CATCH_THROW(
"AssembleErrorEstimator: Cannot create Data Evaluator.");
2018 template <
typename TElem,
typename TIterator>
2025 TIterator iterBegin,
2028 bool bNonRegularGrid,
2029 const std::vector<number>& vScaleMass,
2030 const std::vector<number>& vScaleStiff,
2035 if (iterBegin == iterEnd)
return;
2044 if(vScaleMass.size() != vScaleStiff.size())
2045 UG_THROW(
"(instationary) AssembleErrorEstimator: s_a and s_m must have same size.");
2047 if(vSol->size() < vScaleStiff.size())
2048 UG_THROW(
"(instationary) AssembleErrorEstimator: Time stepping scheme needs at "
2049 "least "<<vScaleStiff.size()<<
" time steps, but only "<<
2050 vSol->size() <<
" passed.");
2060 vElemDisc, dd->function_pattern(), bNonRegularGrid,
2061 &locTimeSeries, &vScaleMass, &vScaleStiff);
2064 Eval.prepare_err_est_elem_loop(
id, si);
2070 for (TIterator iter = iterBegin; iter != iterEnd; ++iter)
2073 TElem* elem = *iter;
2079 dd->indices(elem, ind,
Eval.use_hanging());
2085 for (std::size_t t = 0; t < vScaleStiff.size(); ++t)
2089 Eval.set_time_point(t);
2094 Eval.prepare_err_est_elem(locU, elem, vCornerCoords, ind,
false);
2096 UG_CATCH_THROW(
"AssembleErrorEstimator: Cannot prepare element.");
2101 Eval.compute_err_est_A_elem(locU, elem, vCornerCoords, ind, vScaleMass[t], vScaleStiff[t]);
2103 UG_CATCH_THROW(
"AssembleErrorEstimator: Cannot assemble the error estimator for stiffness part.");
2108 Eval.compute_err_est_M_elem(locU, elem, vCornerCoords, ind, vScaleMass[t], vScaleStiff[t]);
2110 UG_CATCH_THROW(
"AssembleErrorEstimator: Cannot assemble the error estimator for stiffness part.");
2115 Eval.compute_err_est_rhs_elem(elem, vCornerCoords, ind, vScaleMass[t], vScaleStiff[t]);
2117 UG_CATCH_THROW(
"AssembleErrorEstimator: Cannot assemble the error estimator for stiffness part.");
2124 Eval.finish_err_est_elem_loop();
2126 UG_CATCH_THROW(
"AssembleErrorEstimator: Cannot finish element loop.");
2129 UG_CATCH_THROW(
"AssembleErrorEstimator: Cannot create Data Evaluator.");
The AssemblingTuner class combines tools to adapt the assembling routine.
Definition: ass_tuner.h:90
Evaluation for IElemDisc.
Definition: data_evaluator.h:169
Definition: debug_id.h:94
Evaluation for IElemError.
Definition: data_evaluator.h:151
Definition: elem_disc_interface.h:800
Definition: elem_disc_interface.h:760
Definition: local_algebra.h:50
Definition: local_algebra.h:422
void resize(const LocalIndices &ind)
resize for same ind in row and column
Definition: local_algebra.h:445
this_type & scale_append(number s, const this_type &rhs)
add scaled matrix
Definition: local_algebra.h:523
Definition: local_algebra.h:198
this_type & scale_append(number s, const this_type &rhs)
add a scaled vector
Definition: local_algebra.h:292
void resize(const LocalIndices &ind)
resize for current local indices
Definition: local_algebra.h:214
time series of local vectors
Definition: solution_time_series.h:167
void read_values(ConstSmartPtr< VectorTimeSeries< TVector > > vecTimeSeries, LocalIndices &ind)
extract local values from global vectors
Definition: solution_time_series.h:196
void read_times(ConstSmartPtr< VectorTimeSeries< TVector > > vecTimeSeries)
extract time points
Definition: solution_time_series.h:208
number time(size_t i) const
returns time point i
Definition: solution_time_series.h:176
const LocalVector & solution(size_t i) const
returns the local vector for the i'th time point
Definition: solution_time_series.h:182
a mathematical Vector with N entries.
Definition: math_vector.h:97
Global assembler based on the straightforward application of the local discretizations.
Definition: elem_disc_assemble_util.h:78
static void FinishTimestep(const std::vector< IElemDisc< domain_type > * > &vElemDisc, ConstSmartPtr< DoFDistribution > dd, bool bNonRegularGrid, ConstSmartPtr< VectorTimeSeries< vector_type > > vSol, ConstSmartPtr< AssemblingTuner< TAlgebra > > spAssTuner)
Definition: elem_disc_assemble_util.h:1696
static void AssembleMassMatrix(const std::vector< IElemDisc< domain_type > * > &vElemDisc, ConstSmartPtr< domain_type > spDomain, ConstSmartPtr< DoFDistribution > dd, TIterator iterBegin, TIterator iterEnd, int si, bool bNonRegularGrid, matrix_type &M, const vector_type &u, ConstSmartPtr< AssemblingTuner< TAlgebra > > spAssTuner)
Definition: elem_disc_assemble_util.h:221
static void AssembleLinear(const std::vector< IElemDisc< domain_type > * > &vElemDisc, ConstSmartPtr< domain_type > spDomain, ConstSmartPtr< DoFDistribution > dd, TIterator iterBegin, TIterator iterEnd, int si, bool bNonRegularGrid, matrix_type &A, vector_type &rhs, ConstSmartPtr< AssemblingTuner< TAlgebra > > spAssTuner)
Definition: elem_disc_assemble_util.h:904
static void AssembleErrorEstimator(const std::vector< IElemError< domain_type > * > &vElemDisc, ConstSmartPtr< domain_type > spDomain, ConstSmartPtr< DoFDistribution > dd, TIterator iterBegin, TIterator iterEnd, int si, bool bNonRegularGrid, const vector_type &u)
Definition: elem_disc_assemble_util.h:1913
static void AssembleErrorEstimator(const std::vector< IElemError< domain_type > * > &vElemDisc, ConstSmartPtr< domain_type > spDomain, ConstSmartPtr< DoFDistribution > dd, TIterator iterBegin, TIterator iterEnd, int si, bool bNonRegularGrid, const std::vector< number > &vScaleMass, const std::vector< number > &vScaleStiff, ConstSmartPtr< VectorTimeSeries< vector_type > > vSol)
Definition: elem_disc_assemble_util.h:2021
static void AssembleJacobian(const std::vector< IElemDisc< domain_type > * > &vElemDisc, ConstSmartPtr< domain_type > spDomain, ConstSmartPtr< DoFDistribution > dd, TIterator iterBegin, TIterator iterEnd, int si, bool bNonRegularGrid, matrix_type &J, const vector_type &u, ConstSmartPtr< AssemblingTuner< TAlgebra > > spAssTuner)
Definition: elem_disc_assemble_util.h:328
TAlgebra algebra_type
Algebra type.
Definition: elem_disc_assemble_util.h:83
algebra_type::vector_type vector_type
Vector type in the algebra.
Definition: elem_disc_assemble_util.h:86
static void PrepareTimestep(const std::vector< IElemDisc< domain_type > * > &vElemDisc, ConstSmartPtr< DoFDistribution > dd, bool bNonRegularGrid, ConstSmartPtr< VectorTimeSeries< vector_type > > vSol, number future_time, ConstSmartPtr< AssemblingTuner< TAlgebra > > spAssTuner)
Definition: elem_disc_assemble_util.h:1539
static void AssembleRhs(const std::vector< IElemDisc< domain_type > * > &vElemDisc, ConstSmartPtr< domain_type > spDomain, ConstSmartPtr< DoFDistribution > dd, TIterator iterBegin, TIterator iterEnd, int si, bool bNonRegularGrid, vector_type &rhs, const vector_type &u, ConstSmartPtr< AssemblingTuner< TAlgebra > > spAssTuner)
Definition: elem_disc_assemble_util.h:1251
static void PrepareTimestepElem(const std::vector< IElemDisc< domain_type > * > &vElemDisc, ConstSmartPtr< domain_type > spDomain, ConstSmartPtr< DoFDistribution > dd, TIterator iterBegin, TIterator iterEnd, int si, bool bNonRegularGrid, ConstSmartPtr< VectorTimeSeries< vector_type > > vSol, ConstSmartPtr< AssemblingTuner< TAlgebra > > spAssTuner)
Definition: elem_disc_assemble_util.h:1597
static void AssembleDefect(const std::vector< IElemDisc< domain_type > * > &vElemDisc, ConstSmartPtr< domain_type > spDomain, ConstSmartPtr< DoFDistribution > dd, TIterator iterBegin, TIterator iterEnd, int si, bool bNonRegularGrid, vector_type &d, const vector_type &u, ConstSmartPtr< AssemblingTuner< TAlgebra > > spAssTuner)
Definition: elem_disc_assemble_util.h:579
static void AssembleStiffnessMatrix(const std::vector< IElemDisc< domain_type > * > &vElemDisc, ConstSmartPtr< domain_type > spDomain, ConstSmartPtr< DoFDistribution > dd, TIterator iterBegin, TIterator iterEnd, int si, bool bNonRegularGrid, matrix_type &A, const vector_type &u, ConstSmartPtr< AssemblingTuner< TAlgebra > > spAssTuner)
Definition: elem_disc_assemble_util.h:114
static void AssembleLinear(const std::vector< IElemDisc< domain_type > * > &vElemDisc, ConstSmartPtr< domain_type > spDomain, ConstSmartPtr< DoFDistribution > dd, TIterator iterBegin, TIterator iterEnd, int si, bool bNonRegularGrid, matrix_type &A, vector_type &rhs, ConstSmartPtr< VectorTimeSeries< vector_type > > vSol, const std::vector< number > &vScaleMass, const std::vector< number > &vScaleStiff, ConstSmartPtr< AssemblingTuner< TAlgebra > > spAssTuner)
Definition: elem_disc_assemble_util.h:1032
algebra_type::matrix_type matrix_type
Matrix type in the algebra.
Definition: elem_disc_assemble_util.h:89
static void AssembleRhs(const std::vector< IElemDisc< domain_type > * > &vElemDisc, ConstSmartPtr< domain_type > spDomain, ConstSmartPtr< DoFDistribution > dd, TIterator iterBegin, TIterator iterEnd, int si, bool bNonRegularGrid, vector_type &rhs, ConstSmartPtr< VectorTimeSeries< vector_type > > vSol, const std::vector< number > &vScaleMass, const std::vector< number > &vScaleStiff, ConstSmartPtr< AssemblingTuner< TAlgebra > > spAssTuner)
Definition: elem_disc_assemble_util.h:1363
TDomain domain_type
Domain type.
Definition: elem_disc_assemble_util.h:80
static void AssembleJacobian(const std::vector< IElemDisc< domain_type > * > &vElemDisc, ConstSmartPtr< domain_type > spDomain, ConstSmartPtr< DoFDistribution > dd, TIterator iterBegin, TIterator iterEnd, int si, bool bNonRegularGrid, matrix_type &J, ConstSmartPtr< VectorTimeSeries< vector_type > > vSol, number s_a0, ConstSmartPtr< AssemblingTuner< TAlgebra > > spAssTuner)
Definition: elem_disc_assemble_util.h:440
static void AssembleDefect(const std::vector< IElemDisc< domain_type > * > &vElemDisc, ConstSmartPtr< domain_type > spDomain, ConstSmartPtr< DoFDistribution > dd, TIterator iterBegin, TIterator iterEnd, int si, bool bNonRegularGrid, vector_type &d, ConstSmartPtr< VectorTimeSeries< vector_type > > vSol, const std::vector< number > &vScaleMass, const std::vector< number > &vScaleStiff, ConstSmartPtr< AssemblingTuner< TAlgebra > > spAssTuner)
Definition: elem_disc_assemble_util.h:714
static void FinishTimestepElem(const std::vector< IElemDisc< domain_type > * > &vElemDisc, ConstSmartPtr< domain_type > spDomain, ConstSmartPtr< DoFDistribution > dd, TIterator iterBegin, TIterator iterEnd, int si, bool bNonRegularGrid, ConstSmartPtr< VectorTimeSeries< vector_type > > vSol, ConstSmartPtr< AssemblingTuner< TAlgebra > > spAssTuner)
Definition: elem_disc_assemble_util.h:1753
static void InitAllExports(const std::vector< IElemDisc< domain_type > * > &vElemDisc, ConstSmartPtr< DoFDistribution > dd, TIterator iterBegin, TIterator iterEnd, int si, bool bNonRegularGrid, bool bAsTimeDependent)
Definition: elem_disc_assemble_util.h:1857
time series of solutions and corresponding time point
Definition: solution_time_series.h:59
Definition: grid_base_object_traits.h:68
#define EL_PROFILE_BEGIN(name)
Definition: elem_disc_assemble_util.h:54
#define EL_PROFILE_END()
Definition: elem_disc_assemble_util.h:55
#define UG_CATCH_THROW(msg)
Definition: error.h:64
#define UG_THROW(msg)
Definition: error.h:57
#define UG_DLOG(__debugID__, level, msg)
Definition: log.h:298
double number
Definition: types.h:124
SmartPtr< typename TAlgebra::vector_type > Eval(SmartPtr< VecScaleAddClass< TAlgebra > > vsac)
Definition: bridge_mat_vec_operations.h:141
const int NUM_VERTICES
Definition: hexahedron_rules.h:45
ReferenceObjectID
these ids are used to identify the shape of a geometric object.
Definition: grid_base_objects.h:74
@ PT_INSTATIONARY
Definition: data_evaluator.h:42
@ PT_STATIONARY
Definition: data_evaluator.h:42
@ NONE
Definition: data_import.h:44
@ STIFF
Definition: data_import.h:46
@ RHS
Definition: data_import.h:47
@ EXPL
Definition: data_import.h:48
@ MASS
Definition: data_import.h:45
void FillCornerCoordinates(typename TDomain::position_type vCornerCoordsOut[], const TElem &elem, const TDomain &domain)
returns the corner coordinates of a geometric object
Definition: domain_util_impl.h:114
void GetLocalVector(LocalVector &lvec, const TVector &vec)
Definition: local_algebra.h:739
DebugID DID_ELEM_DISC_ASSEMBLE_UTIL("ELEM_DISC_ASSEMBLE_UTIL")
Definition: elem_disc_assemble_util.h:65
Definition: elem_disc_interface.h:77
size_t id()
Definition: util_algebra_dependent.h:130
static AlgebraTypeIDProvider & instance()
Definition: util_algebra_dependent.h:107