33 #ifndef __H__UG__LIB_DISC__SPATIAL_DISC__DOMAIN_DISC_IMPL__
34 #define __H__UG__LIB_DISC__SPATIAL_DISC__DOMAIN_DISC_IMPL__
48 template <
class TElemDisc>
51 for(
size_t i = 0; i < vElemDisc.size(); ++i)
53 vElemDisc[i]->prep_assemble_loop();
57 template <
class TElemDisc>
60 for(
size_t i = 0; i < vElemDisc.size(); ++i)
62 vElemDisc[i]->post_assemble_loop();
67 template <
typename TDomain,
typename TAlgebra,
typename TGlobAssembler>
71 if(!m_spApproxSpace.valid())
72 UG_THROW(
"DomainDiscretization: Before using the "
73 "DomainDiscretization an ApproximationSpace must be set to it. "
74 "Please use DomainDiscretization:set_approximation_space to "
75 "set an appropriate Space.");
79 for(
size_t i = 0; i < m_vDomainElemDisc.size(); ++i)
81 m_vDomainElemDisc[i]->set_approximation_space(m_spApproxSpace);
83 if(!(m_spAssTuner->elem_disc_type_enabled(m_vDomainElemDisc[i]->type())))
continue;
84 m_vElemDisc.push_back(m_vDomainElemDisc[i].
get());
88 template <
typename TDomain,
typename TAlgebra,
typename TGlobAssembler>
92 if(!m_spApproxSpace.valid())
93 UG_THROW(
"DomainDiscretization: Before using the "
94 "DomainDiscretization an ApproximationSpace must be set to it. "
95 "Please use DomainDiscretization:set_approximation_space to "
96 "set an appropriate Space.");
100 for(
size_t i = 0; i < m_vDomainElemError.size(); ++i)
102 m_vDomainElemError[i]->set_approximation_space(m_spApproxSpace);
104 if(!(m_spAssTuner->elem_disc_type_enabled(m_vDomainElemError[i]->type())))
continue;
105 m_vElemError.push_back(m_vDomainElemError[i].
get());
111 template <
typename TDomain,
typename TAlgebra,
typename TGlobAssembler>
115 if(!m_spApproxSpace.valid())
116 UG_THROW(
"DomainDiscretization: Before using the "
117 "DomainDiscretization an ApproximationSpace must be set to it. "
118 "Please use DomainDiscretization:set_approximation_space to "
119 "set an appropriate Space.");
122 for(
size_t i = 0; i < m_vConstraint.size(); ++i)
123 m_vConstraint[i]->set_approximation_space(m_spApproxSpace);
126 template <
typename TDomain,
typename TAlgebra,
typename TGlobAssembler>
130 update_constraints();
133 template <
typename TDomain,
typename TAlgebra,
typename TGlobAssembler>
136 update_elem_errors();
137 update_constraints();
143 template <
typename TDomain,
typename TAlgebra,
typename TGlobAssembler>
154 m_spAssTuner->resize(dd, M);
158 std::vector<SubsetGroup> vSSGrp;
163 }
UG_CATCH_THROW(
"'DomainDiscretization': Can not create Subset Groups and Union.");
166 for(
size_t i = 0; i < unionSubsets.
size(); ++i)
169 const int si = unionSubsets[i];
178 if(m_spAssTuner->regular_grid_forced()) bNonRegularGrid =
false;
181 std::vector<IElemDisc<TDomain>*> vSubsetElemDisc;
192 this->
template AssembleMassMatrix<RegularVertex>
193 (vSubsetElemDisc, dd, si, bNonRegularGrid, M, u);
196 this->
template AssembleMassMatrix<RegularEdge>
197 (vSubsetElemDisc, dd, si, bNonRegularGrid, M, u);
199 this->
template AssembleMassMatrix<ConstrainingEdge>
200 (vSubsetElemDisc, dd, si, bNonRegularGrid, M, u);
203 this->
template AssembleMassMatrix<Triangle>
204 (vSubsetElemDisc, dd, si, bNonRegularGrid, M, u);
205 this->
template AssembleMassMatrix<Quadrilateral>
206 (vSubsetElemDisc, dd, si, bNonRegularGrid, M, u);
208 this->
template AssembleMassMatrix<ConstrainingTriangle>
209 (vSubsetElemDisc, dd, si, bNonRegularGrid, M, u);
210 this->
template AssembleMassMatrix<ConstrainingQuadrilateral>
211 (vSubsetElemDisc, dd, si, bNonRegularGrid, M, u);
214 this->
template AssembleMassMatrix<Tetrahedron>
215 (vSubsetElemDisc, dd, si, bNonRegularGrid, M, u);
216 this->
template AssembleMassMatrix<Pyramid>
217 (vSubsetElemDisc, dd, si, bNonRegularGrid, M, u);
218 this->
template AssembleMassMatrix<Prism>
219 (vSubsetElemDisc, dd, si, bNonRegularGrid, M, u);
220 this->
template AssembleMassMatrix<Hexahedron>
221 (vSubsetElemDisc, dd, si, bNonRegularGrid, M, u);
222 this->
template AssembleMassMatrix<Octahedron>
223 (vSubsetElemDisc, dd, si, bNonRegularGrid, M, u);
226 UG_THROW(
"DomainDiscretization::assemble_mass_matrix:"
227 "Dimension "<<
dim<<
" (subset="<<si<<
") not supported.");
231 " Assembling of elements of Dimension " <<
dim <<
" in "
232 " subset "<<si<<
" failed.");
237 for(
int type = 1; type <
CT_ALL; type = type << 1){
238 if(!(m_spAssTuner->constraint_type_enabled(type)))
continue;
239 for(
size_t i = 0; i < m_vConstraint.size(); ++i)
240 if(m_vConstraint[i]->type() & type)
242 m_vConstraint[i]->set_ass_tuner(m_spAssTuner);
243 m_vConstraint[i]->adjust_jacobian(M, u, dd, type);
248 " Cannot execute post process.");
253 M.set_layouts(dd->layouts());
268 template <
typename TDomain,
typename TAlgebra,
typename TGlobAssembler>
269 template <
typename TElem>
273 int si,
bool bNonRegularGrid,
278 if(m_spAssTuner->selected_elements_used())
280 std::vector<TElem*> vElem;
281 m_spAssTuner->collect_selected_elements(vElem, dd, si);
285 gass_type::template AssembleMassMatrix<TElem>
286 (vElemDisc, m_spApproxSpace->domain(), dd, vElem.begin(), vElem.end(), si,
287 bNonRegularGrid, M, u, m_spAssTuner);
292 gass_type::template AssembleMassMatrix<TElem>
293 (vElemDisc, m_spApproxSpace->domain(), dd,
294 dd->template begin<TElem>(si), dd->template end<TElem>(si), si,
295 bNonRegularGrid, M, u, m_spAssTuner);
303 template <
typename TDomain,
typename TAlgebra,
typename TGlobAssembler>
314 m_spAssTuner->resize(dd, A);
318 std::vector<SubsetGroup> vSSGrp;
323 }
UG_CATCH_THROW(
"'DomainDiscretization': Can not create Subset Groups and Union.");
326 for(
size_t i = 0; i < unionSubsets.
size(); ++i)
329 const int si = unionSubsets[i];
338 if(m_spAssTuner->regular_grid_forced()) bNonRegularGrid =
false;
341 std::vector<IElemDisc<TDomain>*> vSubsetElemDisc;
352 this->
template AssembleStiffnessMatrix<RegularVertex>
353 (vSubsetElemDisc, dd, si, bNonRegularGrid, A, u);
356 this->
template AssembleStiffnessMatrix<RegularEdge>
357 (vSubsetElemDisc, dd, si, bNonRegularGrid, A, u);
359 this->
template AssembleStiffnessMatrix<ConstrainingEdge>
360 (vSubsetElemDisc, dd, si, bNonRegularGrid, A, u);
363 this->
template AssembleStiffnessMatrix<Triangle>
364 (vSubsetElemDisc, dd, si, bNonRegularGrid, A, u);
365 this->
template AssembleStiffnessMatrix<Quadrilateral>
366 (vSubsetElemDisc, dd, si, bNonRegularGrid, A, u);
368 this->
template AssembleStiffnessMatrix<ConstrainingTriangle>
369 (vSubsetElemDisc, dd, si, bNonRegularGrid, A, u);
370 this->
template AssembleStiffnessMatrix<ConstrainingQuadrilateral>
371 (vSubsetElemDisc, dd, si, bNonRegularGrid, A, u);
374 this->
template AssembleStiffnessMatrix<Tetrahedron>
375 (vSubsetElemDisc, dd, si, bNonRegularGrid, A, u);
376 this->
template AssembleStiffnessMatrix<Pyramid>
377 (vSubsetElemDisc, dd, si, bNonRegularGrid, A, u);
378 this->
template AssembleStiffnessMatrix<Prism>
379 (vSubsetElemDisc, dd, si, bNonRegularGrid, A, u);
380 this->
template AssembleStiffnessMatrix<Hexahedron>
381 (vSubsetElemDisc, dd, si, bNonRegularGrid, A, u);
382 this->
template AssembleStiffnessMatrix<Octahedron>
383 (vSubsetElemDisc, dd, si, bNonRegularGrid, A, u);
386 UG_THROW(
"DomainDiscretization::assemble_stiffness_matrix:"
387 "Dimension "<<
dim<<
" (subset="<<si<<
") not supported.");
391 " Assembling of elements of Dimension " <<
dim <<
" in "
392 " subset "<<si<<
" failed.");
397 for(
int type = 1; type <
CT_ALL; type = type << 1){
398 if(!(m_spAssTuner->constraint_type_enabled(type)))
continue;
399 for(
size_t i = 0; i < m_vConstraint.size(); ++i)
400 if(m_vConstraint[i]->type() & type)
402 m_vConstraint[i]->set_ass_tuner(m_spAssTuner);
403 m_vConstraint[i]->adjust_jacobian(A, u, dd, type);
407 }
UG_CATCH_THROW(
"DomainDiscretization::assemble_stiffness_matrix:"
408 " Cannot execute post process.");
413 A.set_layouts(dd->layouts());
428 template <
typename TDomain,
typename TAlgebra,
typename TGlobAssembler>
429 template <
typename TElem>
433 int si,
bool bNonRegularGrid,
438 if(m_spAssTuner->selected_elements_used())
440 std::vector<TElem*> vElem;
441 m_spAssTuner->collect_selected_elements(vElem, dd, si);
445 gass_type::template AssembleStiffnessMatrix<TElem>
446 (vElemDisc, m_spApproxSpace->domain(), dd, vElem.begin(), vElem.end(), si,
447 bNonRegularGrid, A, u, m_spAssTuner);
452 gass_type::template AssembleStiffnessMatrix<TElem>
453 (vElemDisc, m_spApproxSpace->domain(), dd,
454 dd->template begin<TElem>(si), dd->template end<TElem>(si), si,
455 bNonRegularGrid, A, u, m_spAssTuner);
469 template <
typename TDomain,
typename TAlgebra,
typename TGlobAssembler>
481 m_spAssTuner->resize(dd, J);
485 std::vector<SubsetGroup> vSSGrp;
490 if( m_spAssTuner->modify_solution_enabled() ){
491 pModifyMemory = u.clone();
492 pModifyU = pModifyMemory.
get();
494 for(
int type = 1; type <
CT_ALL; type = type << 1){
495 if(!(m_spAssTuner->constraint_type_enabled(type)))
continue;
496 for(
size_t i = 0; i < m_vConstraint.size(); ++i)
497 if(m_vConstraint[i]->type() & type)
498 m_vConstraint[i]->modify_solution(*pModifyMemory, u, dd, type);
508 }
UG_CATCH_THROW(
"'DomainDiscretization': Can not create Subset Groups and Union.");
511 for(
size_t i = 0; i < unionSubsets.
size(); ++i)
514 const int si = unionSubsets[i];
523 if(m_spAssTuner->regular_grid_forced()) bNonRegularGrid =
false;
526 std::vector<IElemDisc<TDomain>*> vSubsetElemDisc;
537 this->
template AssembleJacobian<RegularVertex>
538 (vSubsetElemDisc, dd, si, bNonRegularGrid, J, *pModifyU);
541 this->
template AssembleJacobian<RegularEdge>
542 (vSubsetElemDisc, dd, si, bNonRegularGrid, J, *pModifyU);
544 this->
template AssembleJacobian<ConstrainingEdge>
545 (vSubsetElemDisc, dd, si, bNonRegularGrid, J, *pModifyU);
548 this->
template AssembleJacobian<Triangle>
549 (vSubsetElemDisc, dd, si, bNonRegularGrid, J, *pModifyU);
550 this->
template AssembleJacobian<Quadrilateral>
551 (vSubsetElemDisc, dd, si, bNonRegularGrid, J, *pModifyU);
553 this->
template AssembleJacobian<ConstrainingTriangle>
554 (vSubsetElemDisc, dd, si, bNonRegularGrid, J, *pModifyU);
555 this->
template AssembleJacobian<ConstrainingQuadrilateral>
556 (vSubsetElemDisc, dd, si, bNonRegularGrid, J, *pModifyU);
559 this->
template AssembleJacobian<Tetrahedron>
560 (vSubsetElemDisc, dd, si, bNonRegularGrid, J, *pModifyU);
561 this->
template AssembleJacobian<Pyramid>
562 (vSubsetElemDisc, dd, si, bNonRegularGrid, J, *pModifyU);
563 this->
template AssembleJacobian<Prism>
564 (vSubsetElemDisc, dd, si, bNonRegularGrid, J, *pModifyU);
565 this->
template AssembleJacobian<Hexahedron>
566 (vSubsetElemDisc, dd, si, bNonRegularGrid, J, *pModifyU);
567 this->
template AssembleJacobian<Octahedron>
568 (vSubsetElemDisc, dd, si, bNonRegularGrid, J, *pModifyU);
571 UG_THROW(
"DomainDiscretization::assemble_jacobian (stationary):"
572 "Dimension "<<
dim<<
"(subset="<<si<<
") not supported");
576 " Assembling of elements of Dimension " <<
dim <<
" in "
577 " subset "<<si<<
" failed.");
582 for(
int type = 1; type <
CT_ALL; type = type << 1){
583 if(!(m_spAssTuner->constraint_type_enabled(type)))
continue;
584 for(
size_t i = 0; i < m_vConstraint.size(); ++i)
585 if(m_vConstraint[i]->type() & type)
587 m_vConstraint[i]->set_ass_tuner(m_spAssTuner);
588 m_vConstraint[i]->adjust_jacobian(J, *pModifyU, dd, type);
593 " Cannot execute post process.");
598 J.set_layouts(dd->layouts());
612 template <
typename TDomain,
typename TAlgebra,
typename TGlobAssembler>
613 template <
typename TElem>
617 int si,
bool bNonRegularGrid,
622 if(m_spAssTuner->selected_elements_used())
624 std::vector<TElem*> vElem;
625 m_spAssTuner->collect_selected_elements(vElem, dd, si);
629 gass_type::template AssembleJacobian<TElem>
630 (vElemDisc, m_spApproxSpace->domain(), dd, vElem.begin(), vElem.end(), si,
631 bNonRegularGrid, J, u, m_spAssTuner);
636 gass_type::template AssembleJacobian<TElem>
637 (vElemDisc, m_spApproxSpace->domain(), dd,
638 dd->template begin<TElem>(si), dd->template end<TElem>(si), si,
639 bNonRegularGrid, J, u, m_spAssTuner);
646 template <
typename TDomain,
typename TAlgebra,
typename TGlobAssembler>
658 m_spAssTuner->resize(dd, d);
662 std::vector<SubsetGroup> vSSGrp;
667 if( m_spAssTuner->modify_solution_enabled() ){
668 pModifyMemory = u.clone();
669 pModifyU = pModifyMemory.
get();
671 for(
int type = 1; type <
CT_ALL; type = type << 1){
672 if(!(m_spAssTuner->constraint_type_enabled(type)))
continue;
673 for(
size_t i = 0; i < m_vConstraint.size(); ++i)
674 if(m_vConstraint[i]->type() & type)
675 m_vConstraint[i]->modify_solution(*pModifyMemory, u, dd, type);
683 }
UG_CATCH_THROW(
"'DomainDiscretization': Can not create Subset Groups and Union.");
686 for(
size_t i = 0; i < unionSubsets.
size(); ++i)
689 const int si = unionSubsets[i];
698 if(m_spAssTuner->regular_grid_forced()) bNonRegularGrid =
false;
701 std::vector<IElemDisc<TDomain>*> vSubsetElemDisc;
712 this->
template AssembleDefect<RegularVertex>
713 (vSubsetElemDisc, dd, si, bNonRegularGrid, d, *pModifyU);
716 this->
template AssembleDefect<RegularEdge>
717 (vSubsetElemDisc, dd, si, bNonRegularGrid, d, *pModifyU);
719 this->
template AssembleDefect<ConstrainingEdge>
720 (vSubsetElemDisc, dd, si, bNonRegularGrid, d, *pModifyU);
723 this->
template AssembleDefect<Triangle>
724 (vSubsetElemDisc, dd, si, bNonRegularGrid, d, *pModifyU);
725 this->
template AssembleDefect<Quadrilateral>
726 (vSubsetElemDisc, dd, si, bNonRegularGrid, d, *pModifyU);
728 this->
template AssembleDefect<ConstrainingTriangle>
729 (vSubsetElemDisc, dd, si, bNonRegularGrid, d, *pModifyU);
730 this->
template AssembleDefect<ConstrainingQuadrilateral>
731 (vSubsetElemDisc, dd, si, bNonRegularGrid, d, *pModifyU);
734 this->
template AssembleDefect<Tetrahedron>
735 (vSubsetElemDisc, dd, si, bNonRegularGrid, d, *pModifyU);
736 this->
template AssembleDefect<Pyramid>
737 (vSubsetElemDisc, dd, si, bNonRegularGrid, d, *pModifyU);
738 this->
template AssembleDefect<Prism>
739 (vSubsetElemDisc, dd, si, bNonRegularGrid, d, *pModifyU);
740 this->
template AssembleDefect<Hexahedron>
741 (vSubsetElemDisc, dd, si, bNonRegularGrid, d, *pModifyU);
742 this->
template AssembleDefect<Octahedron>
743 (vSubsetElemDisc, dd, si, bNonRegularGrid, d, *pModifyU);
746 UG_THROW(
"DomainDiscretization::assemble_defect (stationary):"
747 "Dimension "<<
dim<<
" (subset="<<si<<
") not supported.");
750 UG_CATCH_THROW(
"DomainDiscretization::assemble_defect (stationary):"
751 " Assembling of elements of Dimension " <<
dim <<
" in "
752 " subset "<<si<<
" failed.");
759 if (m_spAssTuner->constraint_type_enabled(
CT_DIRICHLET))
761 for (
size_t i = 0; i < m_vConstraint.size(); ++i)
765 m_vConstraint[i]->set_ass_tuner(m_spAssTuner);
766 m_vConstraint[i]->adjust_defect(d, *pModifyU, dd,
CT_DIRICHLET);
771 for(
int type = 1; type <
CT_ALL; type = type << 1){
772 if(!(m_spAssTuner->constraint_type_enabled(type)))
continue;
773 for(
size_t i = 0; i < m_vConstraint.size(); ++i)
774 if(m_vConstraint[i]->type() & type)
776 m_vConstraint[i]->set_ass_tuner(m_spAssTuner);
777 m_vConstraint[i]->adjust_defect(d, *pModifyU, dd, type);
801 template <
typename TDomain,
typename TAlgebra,
typename TGlobAssembler>
802 template <
typename TElem>
806 int si,
bool bNonRegularGrid,
811 if(m_spAssTuner->selected_elements_used())
813 std::vector<TElem*> vElem;
814 m_spAssTuner->collect_selected_elements(vElem, dd, si);
818 gass_type::template AssembleDefect<TElem>
819 (vElemDisc, m_spApproxSpace->domain(), dd, vElem.begin(), vElem.end(), si,
820 bNonRegularGrid, d, u, m_spAssTuner);
825 gass_type::template AssembleDefect<TElem>
826 (vElemDisc, m_spApproxSpace->domain(), dd,
827 dd->template begin<TElem>(si), dd->template end<TElem>(si), si,
828 bNonRegularGrid, d, u, m_spAssTuner);
835 template <
typename TDomain,
typename TAlgebra,
typename TGlobAssembler>
846 m_spAssTuner->resize(dd, mat);
847 m_spAssTuner->resize(dd, rhs);
851 std::vector<SubsetGroup> vSSGrp;
856 }
UG_CATCH_THROW(
"DomainDiscretization: Can not create Subset Groups and Union.");
859 for(
size_t i = 0; i < unionSubsets.
size(); ++i)
862 const int si = unionSubsets[i];
871 if(m_spAssTuner->regular_grid_forced()) bNonRegularGrid =
false;
874 std::vector<IElemDisc<TDomain>*> vSubsetElemDisc;
885 this->
template AssembleLinear<RegularVertex>
886 (vSubsetElemDisc, dd, si, bNonRegularGrid, mat, rhs);
889 this->
template AssembleLinear<RegularEdge>
890 (vSubsetElemDisc, dd, si, bNonRegularGrid, mat, rhs);
892 this->
template AssembleLinear<ConstrainingEdge>
893 (vSubsetElemDisc, dd, si, bNonRegularGrid, mat, rhs);
896 this->
template AssembleLinear<Triangle>
897 (vSubsetElemDisc, dd, si, bNonRegularGrid, mat, rhs);
898 this->
template AssembleLinear<Quadrilateral>
899 (vSubsetElemDisc, dd, si, bNonRegularGrid, mat, rhs);
901 this->
template AssembleLinear<ConstrainingTriangle>
902 (vSubsetElemDisc, dd, si, bNonRegularGrid, mat, rhs);
903 this->
template AssembleLinear<ConstrainingQuadrilateral>
904 (vSubsetElemDisc, dd, si, bNonRegularGrid, mat, rhs);
907 this->
template AssembleLinear<Tetrahedron>
908 (vSubsetElemDisc, dd, si, bNonRegularGrid, mat, rhs);
909 this->
template AssembleLinear<Pyramid>
910 (vSubsetElemDisc, dd, si, bNonRegularGrid, mat, rhs);
911 this->
template AssembleLinear<Prism>
912 (vSubsetElemDisc, dd, si, bNonRegularGrid, mat, rhs);
913 this->
template AssembleLinear<Hexahedron>
914 (vSubsetElemDisc, dd, si, bNonRegularGrid, mat, rhs);
915 this->
template AssembleLinear<Octahedron>
916 (vSubsetElemDisc, dd, si, bNonRegularGrid, mat, rhs);
919 UG_THROW(
"DomainDiscretization::assemble_linear (stationary):"
920 "Dimension "<<
dim<<
" (subset="<<si<<
") not supported.");
923 UG_CATCH_THROW(
"DomainDiscretization::assemble_linear (stationary):"
924 " Assembling of elements of Dimension " <<
dim <<
" in "
925 " subset "<<si<<
" failed.");
930 for(
int type = 1; type <
CT_ALL; type = type << 1){
931 if(!(m_spAssTuner->constraint_type_enabled(type)))
continue;
932 for(
size_t i = 0; i < m_vConstraint.size(); ++i)
933 if(m_vConstraint[i]->type() & type)
935 m_vConstraint[i]->set_ass_tuner(m_spAssTuner);
936 m_vConstraint[i]->adjust_linear(mat, rhs, dd, type);
940 }
UG_CATCH_THROW(
"DomainDiscretization::assemble_linear: Cannot post process.");
945 mat.set_layouts(dd->layouts());
962 template <
typename TDomain,
typename TAlgebra,
typename TGlobAssembler>
963 template <
typename TElem>
967 int si,
bool bNonRegularGrid,
972 if(m_spAssTuner->selected_elements_used())
974 std::vector<TElem*> vElem;
975 m_spAssTuner->collect_selected_elements(vElem, dd, si);
979 gass_type::template AssembleLinear<TElem>
980 (vElemDisc, m_spApproxSpace->domain(), dd, vElem.begin(), vElem.end(), si,
981 bNonRegularGrid, A, rhs, m_spAssTuner);
986 gass_type::template AssembleLinear<TElem>
987 (vElemDisc, m_spApproxSpace->domain(), dd,
988 dd->template begin<TElem>(si), dd->template end<TElem>(si), si,
989 bNonRegularGrid, A, rhs, m_spAssTuner);
996 template <
typename TDomain,
typename TAlgebra,
typename TGlobAssembler>
1004 update_disc_items();
1008 m_spAssTuner->resize(dd, rhs);
1012 std::vector<SubsetGroup> vSSGrp;
1017 }
UG_CATCH_THROW(
"'DomainDiscretization': Can not create Subset Groups and Union.");
1020 for(
size_t i = 0; i < unionSubsets.
size(); ++i)
1023 const int si = unionSubsets[i];
1032 if(m_spAssTuner->regular_grid_forced()) bNonRegularGrid =
false;
1035 std::vector<IElemDisc<TDomain>*> vSubsetElemDisc;
1046 this->
template AssembleRhs<RegularVertex>
1047 (vSubsetElemDisc, dd, si, bNonRegularGrid, rhs, u);
1050 this->
template AssembleRhs<RegularEdge>
1051 (vSubsetElemDisc, dd, si, bNonRegularGrid, rhs, u);
1053 this->
template AssembleRhs<ConstrainingEdge>
1054 (vSubsetElemDisc, dd, si, bNonRegularGrid, rhs, u);
1057 this->
template AssembleRhs<Triangle>
1058 (vSubsetElemDisc, dd, si, bNonRegularGrid, rhs, u);
1059 this->
template AssembleRhs<Quadrilateral>
1060 (vSubsetElemDisc, dd, si, bNonRegularGrid, rhs, u);
1062 this->
template AssembleRhs<ConstrainingTriangle>
1063 (vSubsetElemDisc, dd, si, bNonRegularGrid, rhs, u);
1064 this->
template AssembleRhs<ConstrainingQuadrilateral>
1065 (vSubsetElemDisc, dd, si, bNonRegularGrid, rhs, u);
1068 this->
template AssembleRhs<Tetrahedron>
1069 (vSubsetElemDisc, dd, si, bNonRegularGrid, rhs, u);
1070 this->
template AssembleRhs<Pyramid>
1071 (vSubsetElemDisc, dd, si, bNonRegularGrid, rhs, u);
1072 this->
template AssembleRhs<Prism>
1073 (vSubsetElemDisc, dd, si, bNonRegularGrid, rhs, u);
1074 this->
template AssembleRhs<Hexahedron>
1075 (vSubsetElemDisc, dd, si, bNonRegularGrid, rhs, u);
1076 this->
template AssembleRhs<Octahedron>
1077 (vSubsetElemDisc, dd, si, bNonRegularGrid, rhs, u);
1080 UG_THROW(
"DomainDiscretization::assemble_rhs (stationary):"
1081 "Dimension "<<
dim<<
" (subset="<<si<<
") not supported.");
1084 UG_CATCH_THROW(
"DomainDiscretization::assemble_rhs (stationary):"
1085 " Assembling of elements of Dimension " <<
dim <<
" in "
1086 " subset "<<si<<
" failed.");
1091 for(
int type = 1; type <
CT_ALL; type = type << 1){
1092 if(!(m_spAssTuner->constraint_type_enabled(type)))
continue;
1093 for(
size_t i = 0; i < m_vConstraint.size(); ++i)
1094 if(m_vConstraint[i]->type() & type)
1096 m_vConstraint[i]->set_ass_tuner(m_spAssTuner);
1097 m_vConstraint[i]->adjust_rhs(rhs, u, dd, type);
1102 " Cannot execute post process.");
1121 template <
typename TDomain,
typename TAlgebra,
typename TGlobAssembler>
1122 template <
typename TElem>
1126 int si,
bool bNonRegularGrid,
1131 if(m_spAssTuner->selected_elements_used())
1133 std::vector<TElem*> vElem;
1134 m_spAssTuner->collect_selected_elements(vElem, dd, si);
1138 gass_type::template AssembleRhs<TElem>
1139 (vElemDisc, m_spApproxSpace->domain(), dd, vElem.begin(), vElem.end(), si,
1140 bNonRegularGrid, rhs, u, m_spAssTuner);
1145 gass_type::template AssembleRhs<TElem>
1146 (vElemDisc, m_spApproxSpace->domain(), dd, dd->template begin<TElem>(si), dd->template end<TElem>(si), si,
1147 bNonRegularGrid, rhs, u, m_spAssTuner);
1154 template <
typename TDomain,
typename TAlgebra,
typename TGlobAssembler>
1159 update_constraints();
1163 std::vector<int> vType(6);
1172 if (m_spAssTuner->single_index_assembling_enabled()) u.resize(1);
1175 for(
size_t i = 0; i < vType.size(); ++i){
1176 int type = vType[i];
1177 if(!(m_spAssTuner->constraint_type_enabled(type)))
continue;
1178 for(
size_t i = 0; i < m_vConstraint.size(); ++i)
1179 if(m_vConstraint[i]->type() & type)
1181 m_vConstraint[i]->set_ass_tuner(m_spAssTuner);
1182 m_vConstraint[i]->adjust_solution(u, dd, type);
1201 template <
typename TDomain,
typename TAlgebra,
typename TGlobAssembler>
1212 update_disc_items();
1217 size_t num_subsets = sh->num_subsets();
1218 bool bNonRegularGrid =
false;
1219 for (
size_t si = 0; si < num_subsets; ++si)
1223 if(m_spAssTuner->regular_grid_forced()) bNonRegularGrid =
false;
1228 gass_type::PrepareTimestep(m_vElemDisc, dd, bNonRegularGrid, vSol, future_time, m_spAssTuner);
1230 UG_CATCH_THROW(
"DomainDiscretization::prepare_timestep (instationary):" <<
1231 " Preparing time step failed.");
1239 template <
typename TDomain,
typename TAlgebra,
typename TGlobAssembler>
1246 update_disc_items();
1251 std::vector<SubsetGroup> vSSGrp;
1256 }
UG_CATCH_THROW(
"'DomainDiscretization': Can not create Subset Groups and Union.");
1259 for(
size_t i = 0; i < unionSubsets.
size(); ++i)
1262 const int si = unionSubsets[i];
1271 if(m_spAssTuner->regular_grid_forced()) bNonRegularGrid =
false;
1274 std::vector<IElemDisc<TDomain>*> vSubsetElemDisc;
1285 this->
template PrepareTimestepElem<RegularVertex>
1286 (vSubsetElemDisc, dd, si, bNonRegularGrid, vSol);
1289 this->
template PrepareTimestepElem<RegularEdge>
1290 (vSubsetElemDisc, dd, si, bNonRegularGrid, vSol);
1292 this->
template PrepareTimestepElem<ConstrainingEdge>
1293 (vSubsetElemDisc, dd, si, bNonRegularGrid, vSol);
1296 this->
template PrepareTimestepElem<Triangle>
1297 (vSubsetElemDisc, dd, si, bNonRegularGrid, vSol);
1298 this->
template PrepareTimestepElem<Quadrilateral>
1299 (vSubsetElemDisc, dd, si, bNonRegularGrid, vSol);
1301 this->
template PrepareTimestepElem<ConstrainingTriangle>
1302 (vSubsetElemDisc, dd, si, bNonRegularGrid, vSol);
1303 this->
template PrepareTimestepElem<ConstrainingQuadrilateral>
1304 (vSubsetElemDisc, dd, si, bNonRegularGrid, vSol);
1307 this->
template PrepareTimestepElem<Tetrahedron>
1308 (vSubsetElemDisc, dd, si, bNonRegularGrid, vSol);
1309 this->
template PrepareTimestepElem<Pyramid>
1310 (vSubsetElemDisc, dd, si, bNonRegularGrid, vSol);
1311 this->
template PrepareTimestepElem<Prism>
1312 (vSubsetElemDisc, dd, si, bNonRegularGrid, vSol);
1313 this->
template PrepareTimestepElem<Hexahedron>
1314 (vSubsetElemDisc, dd, si, bNonRegularGrid, vSol);
1315 this->
template PrepareTimestepElem<Octahedron>
1316 (vSubsetElemDisc, dd, si, bNonRegularGrid, vSol);
1319 UG_THROW(
"DomainDiscretization::prepare_timestep_elem (instationary):"
1320 "Dimension "<<
dim<<
" (subset="<<si<<
") not supported.");
1323 UG_CATCH_THROW(
"DomainDiscretization::prepare_timestep_elem (instationary):"
1324 " Assembling of elements of Dimension " <<
dim <<
" in "
1325 " subset "<<si<<
" failed.");
1341 template <
typename TDomain,
typename TAlgebra,
typename TGlobAssembler>
1342 template <
typename TElem>
1346 int si,
bool bNonRegularGrid,
1350 if(m_spAssTuner->selected_elements_used())
1352 std::vector<TElem*> vElem;
1353 m_spAssTuner->collect_selected_elements(vElem, dd, si);
1357 gass_type::template PrepareTimestepElem<TElem>
1358 (vElemDisc, m_spApproxSpace->domain(), dd, vElem.begin(), vElem.end(), si,
1359 bNonRegularGrid, vSol, m_spAssTuner);
1364 gass_type::template PrepareTimestepElem<TElem>
1365 (vElemDisc, m_spApproxSpace->domain(), dd,
1366 dd->template begin<TElem>(si), dd->template end<TElem>(si), si,
1367 bNonRegularGrid, vSol, m_spAssTuner);
1374 template <
typename TDomain,
typename TAlgebra,
typename TGlobAssembler>
1382 if (m_spAssTuner->matrix_is_const())
return;
1386 update_disc_items();
1390 m_spAssTuner->resize(dd, J);
1393 const number time = vSol->time(0);
1397 std::vector<SubsetGroup> vSSGrp;
1402 }
UG_CATCH_THROW(
"'DomainDiscretization': Can not create Subset Groups and Union.");
1407 if( m_spAssTuner->modify_solution_enabled() ){
1408 pModifyMemory = vSol->clone();
1409 pModifyU = pModifyMemory;
1411 for(
int type = 1; type <
CT_ALL; type = type << 1){
1412 if(!(m_spAssTuner->constraint_type_enabled(type)))
continue;
1413 for(
size_t i = 0; i < m_vConstraint.size(); ++i)
1414 if(m_vConstraint[i]->type() & type)
1415 m_vConstraint[i]->modify_solution(pModifyMemory, vSol, dd, type);
1417 }
UG_CATCH_THROW(
"'DomainDiscretization': Cannot modify solution.");
1421 for(
size_t i = 0; i < unionSubsets.
size(); ++i)
1424 const int si = unionSubsets[i];
1433 if(m_spAssTuner->regular_grid_forced()) bNonRegularGrid =
false;
1436 std::vector<IElemDisc<TDomain>*> vSubsetElemDisc;
1447 this->
template AssembleJacobian<RegularVertex>
1448 (vSubsetElemDisc, dd, si, bNonRegularGrid, J, pModifyU, s_a0);
1451 this->
template AssembleJacobian<RegularEdge>
1452 (vSubsetElemDisc, dd, si, bNonRegularGrid, J, pModifyU, s_a0);
1454 this->
template AssembleJacobian<ConstrainingEdge>
1455 (vSubsetElemDisc, dd, si, bNonRegularGrid, J, pModifyU, s_a0);
1458 this->
template AssembleJacobian<Triangle>
1459 (vSubsetElemDisc, dd, si, bNonRegularGrid, J, pModifyU, s_a0);
1460 this->
template AssembleJacobian<Quadrilateral>
1461 (vSubsetElemDisc, dd, si, bNonRegularGrid, J, pModifyU, s_a0);
1463 this->
template AssembleJacobian<ConstrainingTriangle>
1464 (vSubsetElemDisc, dd, si, bNonRegularGrid, J, pModifyU, s_a0);
1465 this->
template AssembleJacobian<ConstrainingQuadrilateral>
1466 (vSubsetElemDisc, dd, si, bNonRegularGrid, J, pModifyU, s_a0);
1469 this->
template AssembleJacobian<Tetrahedron>
1470 (vSubsetElemDisc, dd, si, bNonRegularGrid, J, pModifyU, s_a0);
1471 this->
template AssembleJacobian<Pyramid>
1472 (vSubsetElemDisc, dd, si, bNonRegularGrid, J, pModifyU, s_a0);
1473 this->
template AssembleJacobian<Prism>
1474 (vSubsetElemDisc, dd, si, bNonRegularGrid, J, pModifyU, s_a0);
1475 this->
template AssembleJacobian<Hexahedron>
1476 (vSubsetElemDisc, dd, si, bNonRegularGrid, J, pModifyU, s_a0);
1477 this->
template AssembleJacobian<Octahedron>
1478 (vSubsetElemDisc, dd, si, bNonRegularGrid, J, pModifyU, s_a0);
1481 UG_THROW(
"DomainDiscretization::assemble_jacobian (instationary):"
1482 "Dimension "<<
dim<<
" (subset="<<si<<
") not supported.");
1485 UG_CATCH_THROW(
"DomainDiscretization::assemble_jacobian (instationary):"
1486 " Assembling of elements of Dimension " <<
dim <<
" in "
1487 " subset "<<si<<
" failed.");
1492 for(
int type = 1; type <
CT_ALL; type = type << 1){
1493 if(!(m_spAssTuner->constraint_type_enabled(type)))
continue;
1494 for(
size_t i = 0; i < m_vConstraint.size(); ++i)
1495 if(m_vConstraint[i]->type() & type)
1497 m_vConstraint[i]->set_ass_tuner(m_spAssTuner);
1498 m_vConstraint[i]->adjust_jacobian(J, *pModifyU->solution(0), dd, type, time, pModifyU,s_a0);
1507 J.set_layouts(dd->layouts());
1524 template <
typename TDomain,
typename TAlgebra,
typename TGlobAssembler>
1525 template <
typename TElem>
1529 int si,
bool bNonRegularGrid,
1535 if(m_spAssTuner->selected_elements_used())
1537 std::vector<TElem*> vElem;
1538 m_spAssTuner->collect_selected_elements(vElem, dd, si);
1542 gass_type::template AssembleJacobian<TElem>
1543 (vElemDisc, m_spApproxSpace->domain(), dd, vElem.begin(), vElem.end(), si,
1544 bNonRegularGrid, J, vSol, s_a0, m_spAssTuner);
1548 gass_type::template AssembleJacobian<TElem>
1549 (vElemDisc, m_spApproxSpace->domain(), dd,
1550 dd->template begin<TElem>(si), dd->template end<TElem>(si), si,
1551 bNonRegularGrid, J, vSol, s_a0, m_spAssTuner);
1558 template <
typename TDomain,
typename TAlgebra,
typename TGlobAssembler>
1562 const std::vector<number>& vScaleMass,
1563 const std::vector<number>& vScaleStiff,
1568 update_disc_items();
1572 m_spAssTuner->resize(dd, d);
1576 std::vector<SubsetGroup> vSSGrp;
1581 }
UG_CATCH_THROW(
"'DomainDiscretization': Can not create Subset Groups and Union.");
1586 if( m_spAssTuner->modify_solution_enabled() ){
1587 pModifyMemory = vSol->clone();
1588 pModifyU = pModifyMemory;
1590 for(
int type = 1; type <
CT_ALL; type = type << 1){
1591 if(!(m_spAssTuner->constraint_type_enabled(type)))
continue;
1592 for(
size_t i = 0; i < m_vConstraint.size(); ++i)
1593 if(m_vConstraint[i]->type() & type)
1594 m_vConstraint[i]->modify_solution(pModifyMemory, vSol, dd, type);
1596 }
UG_CATCH_THROW(
"'DomainDiscretization: Cannot modify solution.");
1600 for(
size_t i = 0; i < unionSubsets.
size(); ++i)
1603 const int si = unionSubsets[i];
1612 if(m_spAssTuner->regular_grid_forced()) bNonRegularGrid =
false;
1615 std::vector<IElemDisc<TDomain>*> vSubsetElemDisc;
1626 this->
template AssembleDefect<RegularVertex>
1627 (vSubsetElemDisc, dd, si, bNonRegularGrid, d, pModifyU, vScaleMass, vScaleStiff);
1630 this->
template AssembleDefect<RegularEdge>
1631 (vSubsetElemDisc, dd, si, bNonRegularGrid, d, pModifyU, vScaleMass, vScaleStiff);
1633 this->
template AssembleDefect<ConstrainingEdge>
1634 (vSubsetElemDisc, dd, si, bNonRegularGrid, d, pModifyU, vScaleMass, vScaleStiff);
1637 this->
template AssembleDefect<Triangle>
1638 (vSubsetElemDisc, dd, si, bNonRegularGrid, d, pModifyU, vScaleMass, vScaleStiff);
1639 this->
template AssembleDefect<Quadrilateral>
1640 (vSubsetElemDisc, dd, si, bNonRegularGrid, d, pModifyU, vScaleMass, vScaleStiff);
1642 this->
template AssembleDefect<ConstrainingTriangle>
1643 (vSubsetElemDisc, dd, si, bNonRegularGrid, d, pModifyU, vScaleMass, vScaleStiff);
1644 this->
template AssembleDefect<ConstrainingQuadrilateral>
1645 (vSubsetElemDisc, dd, si, bNonRegularGrid, d, pModifyU, vScaleMass, vScaleStiff);
1648 this->
template AssembleDefect<Tetrahedron>
1649 (vSubsetElemDisc, dd, si, bNonRegularGrid, d, pModifyU, vScaleMass, vScaleStiff);
1650 this->
template AssembleDefect<Pyramid>
1651 (vSubsetElemDisc, dd, si, bNonRegularGrid, d, pModifyU, vScaleMass, vScaleStiff);
1652 this->
template AssembleDefect<Prism>
1653 (vSubsetElemDisc, dd, si, bNonRegularGrid, d, pModifyU, vScaleMass, vScaleStiff);
1654 this->
template AssembleDefect<Hexahedron>
1655 (vSubsetElemDisc, dd, si, bNonRegularGrid, d, pModifyU, vScaleMass, vScaleStiff);
1656 this->
template AssembleDefect<Octahedron>
1657 (vSubsetElemDisc, dd, si, bNonRegularGrid, d, pModifyU, vScaleMass, vScaleStiff);
1660 UG_THROW(
"DomainDiscretization::assemble_defect (instationary):"
1661 "Dimension "<<
dim<<
" (subset="<<si<<
") not supported.");
1664 UG_CATCH_THROW(
"DomainDiscretization::assemble_defect (instationary):"
1665 " Assembling of elements of Dimension " <<
dim <<
" in"
1666 " subset "<< si <<
" failed.");
1671 for(
int type = 1; type <
CT_ALL; type = type << 1){
1672 if(!(m_spAssTuner->constraint_type_enabled(type)))
continue;
1673 for(
size_t i = 0; i < m_vConstraint.size(); ++i)
1674 if(m_vConstraint[i]->type() & type)
1676 m_vConstraint[i]->set_ass_tuner(m_spAssTuner);
1677 m_vConstraint[i]->adjust_defect(d, *pModifyU->solution(0), dd, type, pModifyU->time(0), pModifyU, &vScaleMass, &vScaleStiff);
1702 template <
typename TDomain,
typename TAlgebra,
typename TGlobAssembler>
1703 template <
typename TElem>
1707 int si,
bool bNonRegularGrid,
1710 const std::vector<number>& vScaleMass,
1711 const std::vector<number>& vScaleStiff)
1714 if(m_spAssTuner->selected_elements_used())
1716 std::vector<TElem*> vElem;
1717 m_spAssTuner->collect_selected_elements(vElem, dd, si);
1721 gass_type::template AssembleDefect<TElem>
1722 (vElemDisc, m_spApproxSpace->domain(), dd, vElem.begin(), vElem.end(), si,
1723 bNonRegularGrid, d, vSol, vScaleMass, vScaleStiff, m_spAssTuner);
1728 gass_type::template AssembleDefect<TElem>
1729 (vElemDisc, m_spApproxSpace->domain(), dd,
1730 dd->template begin<TElem>(si), dd->template end<TElem>(si), si,
1731 bNonRegularGrid, d, vSol, vScaleMass, vScaleStiff, m_spAssTuner);
1738 template <
typename TDomain,
typename TAlgebra,
typename TGlobAssembler>
1742 const std::vector<number>& vScaleMass,
1743 const std::vector<number>& vScaleStiff,
1748 update_disc_items();
1751 if (!m_spAssTuner->matrix_is_const())
1752 m_spAssTuner->resize(dd, mat);
1753 m_spAssTuner->resize(dd, rhs);
1757 std::vector<SubsetGroup> vSSGrp;
1762 }
UG_CATCH_THROW(
"'DomainDiscretization': Can not create Subset Groups and Union.");
1765 for(
size_t i = 0; i < unionSubsets.
size(); ++i)
1768 const int si = unionSubsets[i];
1777 if(m_spAssTuner->regular_grid_forced()) bNonRegularGrid =
false;
1780 std::vector<IElemDisc<TDomain>*> vSubsetElemDisc;
1791 this->
template AssembleLinear<RegularVertex>
1792 (vSubsetElemDisc, dd, si, bNonRegularGrid, mat, rhs, vSol, vScaleMass, vScaleStiff);
1795 this->
template AssembleLinear<RegularEdge>
1796 (vSubsetElemDisc, dd, si, bNonRegularGrid, mat, rhs, vSol, vScaleMass, vScaleStiff);
1798 this->
template AssembleLinear<ConstrainingEdge>
1799 (vSubsetElemDisc, dd, si, bNonRegularGrid, mat, rhs, vSol, vScaleMass, vScaleStiff);
1802 this->
template AssembleLinear<Triangle>
1803 (vSubsetElemDisc, dd, si, bNonRegularGrid, mat, rhs, vSol, vScaleMass, vScaleStiff);
1804 this->
template AssembleLinear<Quadrilateral>
1805 (vSubsetElemDisc, dd, si, bNonRegularGrid, mat, rhs, vSol, vScaleMass, vScaleStiff);
1807 this->
template AssembleLinear<ConstrainingTriangle>
1808 (vSubsetElemDisc, dd, si, bNonRegularGrid, mat, rhs, vSol, vScaleMass, vScaleStiff);
1809 this->
template AssembleLinear<ConstrainingQuadrilateral>
1810 (vSubsetElemDisc, dd, si, bNonRegularGrid, mat, rhs, vSol, vScaleMass, vScaleStiff);
1813 this->
template AssembleLinear<Tetrahedron>
1814 (vSubsetElemDisc, dd, si, bNonRegularGrid, mat, rhs, vSol, vScaleMass, vScaleStiff);
1815 this->
template AssembleLinear<Pyramid>
1816 (vSubsetElemDisc, dd, si, bNonRegularGrid, mat, rhs, vSol, vScaleMass, vScaleStiff);
1817 this->
template AssembleLinear<Prism>
1818 (vSubsetElemDisc, dd, si, bNonRegularGrid, mat, rhs, vSol, vScaleMass, vScaleStiff);
1819 this->
template AssembleLinear<Hexahedron>
1820 (vSubsetElemDisc, dd, si, bNonRegularGrid, mat, rhs, vSol, vScaleMass, vScaleStiff);
1821 this->
template AssembleLinear<Octahedron>
1822 (vSubsetElemDisc, dd, si, bNonRegularGrid, mat, rhs, vSol, vScaleMass, vScaleStiff);
1825 UG_THROW(
"DomainDiscretization::assemble_linear (instationary):"
1826 "Dimension "<<
dim<<
" (subset="<<si<<
") not supported.");
1829 UG_CATCH_THROW(
"DomainDiscretization::assemble_linear (instationary):"
1830 " Assembling of elements of Dimension " <<
dim <<
" in "
1831 " subset "<<si<<
" failed.");
1836 for(
int type = 1; type <
CT_ALL; type = type << 1){
1837 if(!(m_spAssTuner->constraint_type_enabled(type)))
continue;
1838 for(
size_t i = 0; i < m_vConstraint.size(); ++i)
1839 if(m_vConstraint[i]->type() & type)
1841 m_vConstraint[i]->set_ass_tuner(m_spAssTuner);
1842 m_vConstraint[i]->adjust_linear(mat, rhs, dd, type, vSol->time(0));
1850 mat.set_layouts(dd->layouts());
1871 template <
typename TDomain,
typename TAlgebra,
typename TGlobAssembler>
1872 template <
typename TElem>
1876 int si,
bool bNonRegularGrid,
1880 const std::vector<number>& vScaleMass,
1881 const std::vector<number>& vScaleStiff)
1884 if(m_spAssTuner->selected_elements_used())
1886 std::vector<TElem*> vElem;
1887 m_spAssTuner->collect_selected_elements(vElem, dd, si);
1891 gass_type::template AssembleLinear<TElem>
1892 (vElemDisc, m_spApproxSpace->domain(), dd, vElem.begin(), vElem.end(), si,
1893 bNonRegularGrid, A, rhs, vSol, vScaleMass, vScaleStiff, m_spAssTuner);
1898 gass_type::template AssembleLinear<TElem>
1899 (vElemDisc, m_spApproxSpace->domain(), dd,
1900 dd->template begin<TElem>(si), dd->template end<TElem>(si), si,
1901 bNonRegularGrid, A, rhs, vSol, vScaleMass, vScaleStiff, m_spAssTuner);
1908 template <
typename TDomain,
typename TAlgebra,
typename TGlobAssembler>
1912 const std::vector<number>& vScaleMass,
1913 const std::vector<number>& vScaleStiff,
1918 update_disc_items();
1921 m_spAssTuner->resize(dd, rhs);
1925 std::vector<SubsetGroup> vSSGrp;
1930 }
UG_CATCH_THROW(
"'DomainDiscretization': Can not create Subset Groups and Union.");
1933 for(
size_t i = 0; i < unionSubsets.
size(); ++i)
1936 const int si = unionSubsets[i];
1945 if(m_spAssTuner->regular_grid_forced()) bNonRegularGrid =
false;
1948 std::vector<IElemDisc<TDomain>*> vSubsetElemDisc;
1959 this->
template AssembleRhs<RegularVertex>
1960 (vSubsetElemDisc, dd, si, bNonRegularGrid, rhs, vSol, vScaleMass, vScaleStiff);
1963 this->
template AssembleRhs<RegularEdge>
1964 (vSubsetElemDisc, dd, si, bNonRegularGrid, rhs, vSol, vScaleMass, vScaleStiff);
1966 this->
template AssembleRhs<ConstrainingEdge>
1967 (vSubsetElemDisc, dd, si, bNonRegularGrid, rhs, vSol, vScaleMass, vScaleStiff);
1970 this->
template AssembleRhs<Triangle>
1971 (vSubsetElemDisc, dd, si, bNonRegularGrid, rhs, vSol, vScaleMass, vScaleStiff);
1972 this->
template AssembleRhs<Quadrilateral>
1973 (vSubsetElemDisc, dd, si, bNonRegularGrid, rhs, vSol, vScaleMass, vScaleStiff);
1975 this->
template AssembleRhs<ConstrainingTriangle>
1976 (vSubsetElemDisc, dd, si, bNonRegularGrid, rhs, vSol, vScaleMass, vScaleStiff);
1977 this->
template AssembleRhs<ConstrainingQuadrilateral>
1978 (vSubsetElemDisc, dd, si, bNonRegularGrid, rhs, vSol, vScaleMass, vScaleStiff);
1981 this->
template AssembleRhs<Tetrahedron>
1982 (vSubsetElemDisc, dd, si, bNonRegularGrid, rhs, vSol, vScaleMass, vScaleStiff);
1983 this->
template AssembleRhs<Pyramid>
1984 (vSubsetElemDisc, dd, si, bNonRegularGrid, rhs, vSol, vScaleMass, vScaleStiff);
1985 this->
template AssembleRhs<Prism>
1986 (vSubsetElemDisc, dd, si, bNonRegularGrid, rhs, vSol, vScaleMass, vScaleStiff);
1987 this->
template AssembleRhs<Hexahedron>
1988 (vSubsetElemDisc, dd, si, bNonRegularGrid, rhs, vSol, vScaleMass, vScaleStiff);
1989 this->
template AssembleRhs<Octahedron>
1990 (vSubsetElemDisc, dd, si, bNonRegularGrid, rhs, vSol, vScaleMass, vScaleStiff);
1993 UG_THROW(
"DomainDiscretization::assemble_rhs (instationary):"
1994 "Dimension "<<
dim<<
" (subset="<<si<<
") not supported.");
1997 UG_CATCH_THROW(
"DomainDiscretization::assemble_rhs (instationary):"
1998 " Assembling of elements of Dimension " <<
dim <<
" in "
1999 " subset "<<si<<
" failed.");
2005 for(
int type = 1; type <
CT_ALL; type = type << 1){
2006 if(!(m_spAssTuner->constraint_type_enabled(type)))
continue;
2007 for(
size_t i = 0; i < m_vConstraint.size(); ++i)
2008 if(m_vConstraint[i]->type() & type)
2010 m_vConstraint[i]->set_ass_tuner(m_spAssTuner);
2011 m_vConstraint[i]->adjust_rhs(rhs, *(vSol->solution(0)), dd, type, vSol->time(0));
2035 template <
typename TDomain,
typename TAlgebra,
typename TGlobAssembler>
2036 template <
typename TElem>
2040 int si,
bool bNonRegularGrid,
2043 const std::vector<number>& vScaleMass,
2044 const std::vector<number>& vScaleStiff)
2047 if(m_spAssTuner->selected_elements_used())
2049 std::vector<TElem*> vElem;
2050 m_spAssTuner->collect_selected_elements(vElem, dd, si);
2054 gass_type::template AssembleRhs<TElem>
2055 (vElemDisc, m_spApproxSpace->domain(), dd, vElem.begin(), vElem.end(), si,
2056 bNonRegularGrid, rhs, vSol, vScaleMass, vScaleStiff, m_spAssTuner);
2061 gass_type::template AssembleRhs<TElem>
2062 (vElemDisc, m_spApproxSpace->domain(), dd,
2063 dd->template begin<TElem>(si), dd->template end<TElem>(si), si,
2064 bNonRegularGrid, rhs, vSol, vScaleMass, vScaleStiff, m_spAssTuner);
2071 template <
typename TDomain,
typename TAlgebra,
typename TGlobAssembler>
2076 update_constraints();
2080 std::vector<int> vType(5);
2088 if (m_spAssTuner->single_index_assembling_enabled()) u.resize(1);
2093 for(
size_t i = 0; i < vType.size(); ++i){
2094 int type = vType[i];
2095 if(!(m_spAssTuner->constraint_type_enabled(type)))
continue;
2096 for(
size_t i = 0; i < m_vConstraint.size(); ++i)
2097 if(m_vConstraint[i]->type() & type)
2099 m_vConstraint[i]->set_ass_tuner(m_spAssTuner);
2100 m_vConstraint[i]->adjust_solution(u, dd, type, time);
2110 template <
typename TDomain,
typename TAlgebra,
typename TGlobAssembler>
2116 update_disc_items();
2120 std::vector<SubsetGroup> vSSGrp;
2125 }
UG_CATCH_THROW(
"'DomainDiscretization': Can not create Subset Groups and Union.");
2128 for(
size_t i = 0; i < unionSubsets.
size(); ++i)
2131 const int si = unionSubsets[i];
2140 if(m_spAssTuner->regular_grid_forced()) bNonRegularGrid =
false;
2143 std::vector<IElemDisc<TDomain>*> vSubsetElemDisc;
2154 this->
template InitAllExports<RegularVertex>
2155 (vSubsetElemDisc, dd, si, bNonRegularGrid, bAsTimeDependent);
2158 this->
template InitAllExports<RegularEdge>
2159 (vSubsetElemDisc, dd, si, bNonRegularGrid, bAsTimeDependent);
2161 this->
template InitAllExports<ConstrainingEdge>
2162 (vSubsetElemDisc, dd, si, bNonRegularGrid, bAsTimeDependent);
2165 this->
template InitAllExports<Triangle>
2166 (vSubsetElemDisc, dd, si, bNonRegularGrid, bAsTimeDependent);
2167 this->
template InitAllExports<Quadrilateral>
2168 (vSubsetElemDisc, dd, si, bNonRegularGrid, bAsTimeDependent);
2170 this->
template InitAllExports<ConstrainingTriangle>
2171 (vSubsetElemDisc, dd, si, bNonRegularGrid, bAsTimeDependent);
2172 this->
template InitAllExports<ConstrainingQuadrilateral>
2173 (vSubsetElemDisc, dd, si, bNonRegularGrid, bAsTimeDependent);
2176 this->
template InitAllExports<Tetrahedron>
2177 (vSubsetElemDisc, dd, si, bNonRegularGrid, bAsTimeDependent);
2178 this->
template InitAllExports<Pyramid>
2179 (vSubsetElemDisc, dd, si, bNonRegularGrid, bAsTimeDependent);
2180 this->
template InitAllExports<Prism>
2181 (vSubsetElemDisc, dd, si, bNonRegularGrid, bAsTimeDependent);
2182 this->
template InitAllExports<Hexahedron>
2183 (vSubsetElemDisc, dd, si, bNonRegularGrid, bAsTimeDependent);
2184 this->
template InitAllExports<Octahedron>
2185 (vSubsetElemDisc, dd, si, bNonRegularGrid, bAsTimeDependent);
2188 UG_THROW(
"DomainDiscretization::init_all_exports:"
2189 "Dimension "<<
dim<<
" (subset="<<si<<
") not supported.");
2192 UG_CATCH_THROW(
"DomainDiscretization::assemble_stiffness_matrix:"
2193 " Assembling of elements of Dimension " <<
dim <<
" in "
2194 " subset "<<si<<
" failed.");
2214 template <
typename TDomain,
typename TAlgebra,
typename TGlobAssembler>
2215 template <
typename TElem>
2219 int si,
bool bNonRegularGrid,
bool bAsTimeDependent)
2222 if(m_spAssTuner->selected_elements_used())
2224 std::vector<TElem*> vElem;
2225 m_spAssTuner->collect_selected_elements(vElem, dd, si);
2229 gass_type::template InitAllExports<TElem>
2230 (vElemDisc, dd, vElem.begin(), vElem.end(), si, bNonRegularGrid, bAsTimeDependent);
2235 gass_type::template InitAllExports<TElem>
2237 dd->template begin<TElem>(si), dd->template end<TElem>(si), si,
2238 bNonRegularGrid, bAsTimeDependent);
2248 template <
typename TDomain,
typename T>
2251 for (std::size_t i = 0; i < vElemDisc.size(); ++i)
2255 if (err_est_data == NULL)
continue;
2256 if (
std::find (vErrEstData.begin(), vErrEstData.end(), err_est_data) != vErrEstData.end())
2258 if (err_est_data->
consider_me()) vErrEstData.push_back(err_est_data);
2267 template <
typename TDomain,
typename TAlgebra,
typename TGlobAssembler>
2282 const bool useErrorData = !m_vDomainElemError.empty();
2286 if (useErrorData) { update_error_items();}
2287 else { update_disc_items();}
2291 std::vector<SubsetGroup> vSSGrp;
2296 if (useErrorData) {
CreateSubsetGroups(vSSGrp, unionSubsets, m_vElemError, dd->subset_handler());}
2299 UG_CATCH_THROW(
"'DomainDiscretization': Can not create Subset Groups and Union.");
2302 std::vector<IErrEstData<TDomain>*> vErrEstData;
2318 for (
size_t i = 0; i < vErrEstData.size(); ++i)
2319 vErrEstData[i]->alloc_err_est_data(dd->surface_view(), dd->grid_level());
2321 UG_CATCH_THROW(
"DomainDiscretization::calc_error: Cannot prepare the error estimator");
2326 for (
size_t i = 0; i < unionSubsets.
size(); ++i)
2329 const int si = unionSubsets[i];
2342 GetElemDiscItemOnSubset<IElemError<TDomain>,
IElemDisc<TDomain> > (vSubsetElemError, m_vElemDisc, vSSGrp, si);
2346 (vSubsetElemError, m_vElemError, vSSGrp, si);
2351 (vSubsetElemError, m_vElemDisc, vSSGrp, si);
2361 typename error_vector_type::iterator it = vSubsetElemError.begin();
2362 while (it != vSubsetElemError.end())
2364 if (!(*it)->err_est_enabled())
2365 it = vSubsetElemError.erase(it);
2376 this->
template AssembleErrorEstimator<RegularEdge>
2377 (vSubsetElemError, dd, si, bNonRegularGrid, u);
2379 this->
template AssembleErrorEstimator<ConstrainingEdge>
2380 (vSubsetElemError, dd, si, bNonRegularGrid, u);
2383 this->
template AssembleErrorEstimator<Triangle>
2384 (vSubsetElemError, dd, si, bNonRegularGrid, u);
2385 this->
template AssembleErrorEstimator<Quadrilateral>
2386 (vSubsetElemError, dd, si, bNonRegularGrid, u);
2388 this->
template AssembleErrorEstimator<ConstrainingTriangle>
2389 (vSubsetElemError, dd, si, bNonRegularGrid, u);
2390 this->
template AssembleErrorEstimator<ConstrainingQuadrilateral>
2391 (vSubsetElemError, dd, si, bNonRegularGrid, u);
2394 this->
template AssembleErrorEstimator<Tetrahedron>
2395 (vSubsetElemError, dd, si, bNonRegularGrid, u);
2396 this->
template AssembleErrorEstimator<Pyramid>
2397 (vSubsetElemError, dd, si, bNonRegularGrid, u);
2398 this->
template AssembleErrorEstimator<Prism>
2399 (vSubsetElemError, dd, si, bNonRegularGrid, u);
2400 this->
template AssembleErrorEstimator<Hexahedron>
2401 (vSubsetElemError, dd, si, bNonRegularGrid, u);
2402 this->
template AssembleErrorEstimator<Octahedron>
2403 (vSubsetElemError, dd, si, bNonRegularGrid, u);
2406 UG_THROW(
"DomainDiscretization::calc_error:"
2407 " Dimension "<<
dim<<
" (subset="<<si<<
") not supported.");
2411 " Assembling of elements of Dimension " <<
dim <<
" in "
2412 " subset "<<si<<
" failed.");
2418 for (
int type = 1; type <
CT_ALL; type = type << 1)
2420 if (!(m_spAssTuner->constraint_type_enabled(type)))
continue;
2421 for (
size_t i = 0; i < m_vConstraint.size(); ++i)
2422 if ((m_vConstraint[i]->type() & type) && m_vConstraint[i]->err_est_enabled())
2424 m_vConstraint[i]->set_ass_tuner(m_spAssTuner);
2425 m_vConstraint[i]->adjust_error(u, dd, type);
2434 for (std::size_t i = 0; i < vErrEstData.size(); ++i)
2435 vErrEstData[i]->summarize_err_est_data(m_spApproxSpace->domain());
2437 UG_CATCH_THROW(
"DomainDiscretization::calc_error: Cannot summarize the error estimator");
2443 m_mgElemErrors.attach_indicators(pMG);
2448 elem_iter_type elem_iter_end = sv->template end<elem_type> (gl,
SurfaceView::ALL);
2449 for (elem_iter_type elem = sv->template begin<elem_type> (gl,
SurfaceView::ALL); elem != elem_iter_end; ++elem)
2452 m_mgElemErrors.error(*elem) = 0.0;
2455 std::vector<MathVector<dim> > vCornerCoords = std::vector<MathVector<dim> >(0);
2459 for (std::size_t ee = 0; ee < vErrEstData.size(); ++ee)
2460 m_mgElemErrors.error(*elem) += vErrEstData[ee]->scaling_factor()
2461 * vErrEstData[ee]->get_elem_error_indicator(*elem, &vCornerCoords[0]);
2474 UG_THROW(
"Argument passed as output for error function is not a GridFunction of suitable type.");
2482 elem_iter_type elem_iter_end = sv->template end<elem_type> (gl,
SurfaceView::ALL);
2483 for (elem_iter_type elem = sv->template begin<elem_type> (gl,
SurfaceView::ALL); elem != elem_iter_end; ++elem)
2486 uVTK->
approx_space()->dof_distribution(gl)->indices(*elem, ind,
false);
2489 "Number of functions in grid function passed for error indicator values is not 1 on "
2493 "Number of DoFs in grid function passed for error indicator values is not 1 on "
2503 locU(0,0) = m_mgElemErrors.error(*elem);
2510 this->m_bErrorCalculated =
true;
2514 for(std::size_t i = 0; i < vErrEstData.size(); ++i)
2515 vErrEstData[i]->release_err_est_data();
2517 UG_CATCH_THROW(
"DomainDiscretization::calc_error: Cannot release the error estimator");
2530 template <
typename TDomain,
typename TAlgebra,
typename TGlobAssembler>
2531 template <
typename TElem>
2535 int si,
bool bNonRegularGrid,
2539 gass_type::template AssembleErrorEstimator<TElem>
2540 (vElemDisc, m_spApproxSpace->domain(), dd,
2541 dd->template begin<TElem>(si), dd->template end<TElem>(si),
2542 si, bNonRegularGrid, u);
2551 template <
typename TDomain,
typename TAlgebra,
typename TGlobAssembler>
2555 const std::vector<number>& vScaleMass,
2556 const std::vector<number>& vScaleStiff,
2565 const bool useErrorData = !m_vDomainElemError.empty();
2568 if (useErrorData) { update_error_items();}
2569 else { update_disc_items();}
2573 std::vector<SubsetGroup> vSSGrp;
2578 if (useErrorData) {
CreateSubsetGroups(vSSGrp, unionSubsets, m_vElemError, dd->subset_handler());}
2581 UG_CATCH_THROW(
"'DomainDiscretization': Can not create Subset Groups and Union.");
2584 std::vector<IErrEstData<TDomain>*> vErrEstData;
2592 for (std::size_t i = 0; i < vErrEstData.size(); ++i)
2593 vErrEstData[i]->alloc_err_est_data(dd->surface_view(), dd->grid_level());
2595 UG_CATCH_THROW(
"DomainDiscretization::calc_error: Cannot prepare the error estimator");
2598 for (std::size_t i = 0; i < unionSubsets.
size(); ++i)
2601 const int si = unionSubsets[i];
2615 (vSubsetElemError, m_vElemError, vSSGrp, si);
2620 (vSubsetElemError, m_vElemDisc, vSSGrp, si);
2624 typename error_vector_type::iterator it = vSubsetElemError.begin();
2625 while (it != vSubsetElemError.end())
2627 if (!(*it)->err_est_enabled())
2628 it = vSubsetElemError.erase(it);
2638 this->
template AssembleErrorEstimator<RegularEdge>
2639 (vSubsetElemError, dd, si, bNonRegularGrid, vScaleMass, vScaleStiff, vSol);
2641 this->
template AssembleErrorEstimator<ConstrainingEdge>
2642 (vSubsetElemError, dd, si, bNonRegularGrid, vScaleMass, vScaleStiff, vSol);
2645 this->
template AssembleErrorEstimator<Triangle>
2646 (vSubsetElemError, dd, si, bNonRegularGrid, vScaleMass, vScaleStiff, vSol);
2647 this->
template AssembleErrorEstimator<Quadrilateral>
2648 (vSubsetElemError, dd, si, bNonRegularGrid, vScaleMass, vScaleStiff, vSol);
2650 this->
template AssembleErrorEstimator<ConstrainingTriangle>
2651 (vSubsetElemError, dd, si, bNonRegularGrid, vScaleMass, vScaleStiff, vSol);
2652 this->
template AssembleErrorEstimator<ConstrainingQuadrilateral>
2653 (vSubsetElemError, dd, si, bNonRegularGrid, vScaleMass, vScaleStiff, vSol);
2656 this->
template AssembleErrorEstimator<Tetrahedron>
2657 (vSubsetElemError, dd, si, bNonRegularGrid, vScaleMass, vScaleStiff, vSol);
2658 this->
template AssembleErrorEstimator<Pyramid>
2659 (vSubsetElemError, dd, si, bNonRegularGrid, vScaleMass, vScaleStiff, vSol);
2660 this->
template AssembleErrorEstimator<Prism>
2661 (vSubsetElemError, dd, si, bNonRegularGrid, vScaleMass, vScaleStiff, vSol);
2662 this->
template AssembleErrorEstimator<Hexahedron>
2663 (vSubsetElemError, dd, si, bNonRegularGrid, vScaleMass, vScaleStiff, vSol);
2664 this->
template AssembleErrorEstimator<Octahedron>
2665 (vSubsetElemError, dd, si, bNonRegularGrid, vScaleMass, vScaleStiff, vSol);
2668 UG_THROW(
"DomainDiscretization::calc_error:"
2669 " Dimension "<<
dim<<
" (subset="<<si<<
") not supported.");
2673 " Assembling of elements of Dimension " <<
dim <<
" in "
2674 " subset "<< si <<
"failed.");
2680 for (
int type = 1; type <
CT_ALL; type = type << 1)
2682 if (!(m_spAssTuner->constraint_type_enabled(type)))
continue;
2683 for (
size_t i = 0; i < m_vConstraint.size(); ++i)
2684 if ((m_vConstraint[i]->type() & type) && m_vConstraint[i]->err_est_enabled())
2686 m_vConstraint[i]->set_ass_tuner(m_spAssTuner);
2687 m_vConstraint[i]->adjust_error(*vSol->solution(0), dd, type, vSol->time(0),
2688 vSol, &vScaleMass, &vScaleStiff);
2697 for (std::size_t i = 0; i < vErrEstData.size(); ++i)
2698 vErrEstData[i]->summarize_err_est_data(m_spApproxSpace->domain());
2700 UG_CATCH_THROW(
"DomainDiscretization::calc_error: Cannot summarize the error estimator.");
2706 m_mgElemErrors.attach_indicators(pMG);
2711 elem_iter_type elem_iter_end = sv->template end<elem_type> (gl,
SurfaceView::ALL);
2712 for (elem_iter_type elem = sv->template begin<elem_type> (gl,
SurfaceView::ALL); elem != elem_iter_end; ++elem)
2715 m_mgElemErrors.error(*elem) = 0.0;
2718 std::vector<MathVector<dim> > vCornerCoords = std::vector<MathVector<dim> >(0);
2722 for (std::size_t ee = 0; ee < vErrEstData.size(); ++ee)
2723 m_mgElemErrors.error(*elem) += vErrEstData[ee]->scaling_factor()
2724 * vErrEstData[ee]->get_elem_error_indicator(*elem, &vCornerCoords[0]);
2737 UG_THROW(
"Argument passed as output for error function is not a GridFunction.");
2745 elem_iter_type elem_iter_end = sv->template end<elem_type> (gl,
SurfaceView::ALL);
2746 for (elem_iter_type elem = sv->template begin<elem_type> (gl,
SurfaceView::ALL); elem != elem_iter_end; ++elem)
2749 uVTK->
approx_space()->dof_distribution(gl)->indices(*elem, ind,
false);
2758 locU(0,0) = m_mgElemErrors.error(*elem);
2765 this->m_bErrorCalculated =
true;
2769 for(std::size_t i = 0; i < vErrEstData.size(); ++i)
2770 vErrEstData[i]->release_err_est_data();
2772 UG_CATCH_THROW(
"DomainDiscretization::calc_error: Cannot release the error estimator");
2787 template <
typename TDomain,
typename TAlgebra,
typename TGlobAssembler>
2788 template <
typename TElem>
2792 int si,
bool bNonRegularGrid,
2793 const std::vector<number>& vScaleMass,
2794 const std::vector<number>& vScaleStiff,
2798 gass_type::template AssembleErrorEstimator<TElem>
2799 (vElemDisc, m_spApproxSpace->domain(), dd,
2800 dd->template begin<TElem>(si), dd->template end<TElem>(si),
2801 si, bNonRegularGrid, vScaleMass, vScaleStiff, vSol);
2804 template <
typename TDomain,
typename TAlgebra,
typename TGlobAssembler>
2812 if (!this->m_bErrorCalculated)
2814 UG_THROW(
"Error indicators have to be calculated first by a call to 'calc_error'.");
2818 if (spMarkingStrategy.valid())
2824 template <
typename TDomain,
typename TAlgebra,
typename TGlobAssembler>
2831 if (m_bErrorCalculated)
2833 m_bErrorCalculated =
false;
2834 m_mgElemErrors.detach_indicators();
2839 template <
typename TDomain,
typename TAlgebra,
typename TGlobAssembler>
2844 return this->m_bErrorCalculated;
2850 template <
typename TDomain,
typename TAlgebra,
typename TGlobAssembler>
2860 update_disc_items();
2865 size_t num_subsets = sh->num_subsets();
2866 bool bNonRegularGrid =
false;
2867 for (
size_t si = 0; si < num_subsets; ++si)
2871 if(m_spAssTuner->regular_grid_forced()) bNonRegularGrid =
false;
2876 gass_type::FinishTimestep(m_vElemDisc, dd, bNonRegularGrid, vSol, m_spAssTuner);
2878 UG_CATCH_THROW(
"DomainDiscretization::finish_timestep (instationary):" <<
2879 " Finishing time step failed.");
2887 template <
typename TDomain,
typename TAlgebra,
typename TGlobAssembler>
2894 update_disc_items();
2898 std::vector<SubsetGroup> vSSGrp;
2903 }
UG_CATCH_THROW(
"'DomainDiscretization': Can not create Subset Groups and Union.");
2906 for(
size_t i = 0; i < unionSubsets.
size(); ++i)
2909 const int si = unionSubsets[i];
2918 if(m_spAssTuner->regular_grid_forced()) bNonRegularGrid =
false;
2921 std::vector<IElemDisc<TDomain>*> vSubsetElemDisc;
2932 this->
template FinishTimestepElem<RegularVertex>
2933 (vSubsetElemDisc, dd, si, bNonRegularGrid, vSol);
2936 this->
template FinishTimestepElem<RegularEdge>
2937 (vSubsetElemDisc, dd, si, bNonRegularGrid, vSol);
2939 this->
template FinishTimestepElem<ConstrainingEdge>
2940 (vSubsetElemDisc, dd, si, bNonRegularGrid, vSol);
2943 this->
template FinishTimestepElem<Triangle>
2944 (vSubsetElemDisc, dd, si, bNonRegularGrid, vSol);
2945 this->
template FinishTimestepElem<Quadrilateral>
2946 (vSubsetElemDisc, dd, si, bNonRegularGrid, vSol);
2948 this->
template FinishTimestepElem<ConstrainingTriangle>
2949 (vSubsetElemDisc, dd, si, bNonRegularGrid, vSol);
2950 this->
template FinishTimestepElem<ConstrainingQuadrilateral>
2951 (vSubsetElemDisc, dd, si, bNonRegularGrid, vSol);
2954 this->
template FinishTimestepElem<Tetrahedron>
2955 (vSubsetElemDisc, dd, si, bNonRegularGrid, vSol);
2956 this->
template FinishTimestepElem<Pyramid>
2957 (vSubsetElemDisc, dd, si, bNonRegularGrid, vSol);
2958 this->
template FinishTimestepElem<Prism>
2959 (vSubsetElemDisc, dd, si, bNonRegularGrid, vSol);
2960 this->
template FinishTimestepElem<Hexahedron>
2961 (vSubsetElemDisc, dd, si, bNonRegularGrid, vSol);
2962 this->
template FinishTimestepElem<Octahedron>
2963 (vSubsetElemDisc, dd, si, bNonRegularGrid, vSol);
2966 UG_THROW(
"DomainDiscretization::finish_timestep_elem (instationary):"
2967 "Dimension "<<
dim<<
" (subset="<<si<<
") not supported.");
2970 UG_CATCH_THROW(
"DomainDiscretization::finish_timestep_elem (instationary):"
2971 " Assembling of elements of Dimension " <<
dim <<
" in "
2972 " subset "<<si<<
" failed.");
2988 template <
typename TDomain,
typename TAlgebra,
typename TGlobAssembler>
2989 template <
typename TElem>
2993 int si,
bool bNonRegularGrid,
2997 if(m_spAssTuner->selected_elements_used())
2999 std::vector<TElem*> vElem;
3000 m_spAssTuner->collect_selected_elements(vElem, dd, si);
3004 gass_type::template FinishTimestepElem<TElem>
3005 (vElemDisc, m_spApproxSpace->domain(), dd, vElem.begin(), vElem.end(), si,
3006 bNonRegularGrid, vSol, m_spAssTuner);
3011 gass_type::template FinishTimestepElem<TElem>
3012 (vElemDisc, m_spApproxSpace->domain(), dd,
3013 dd->template begin<TElem>(si), dd->template end<TElem>(si), si,
3014 bNonRegularGrid, vSol, m_spAssTuner);
Definition: smart_pointer.h:296
const T * get() const
Definition: smart_pointer.h:409
T * get()
returns encapsulated pointer
Definition: smart_pointer.h:197
Definition: dof_distribution.h:51
void update_constraints()
Definition: domain_disc_impl.h:112
virtual void calc_error(const vector_type &u, ConstSmartPtr< DoFDistribution > dd, error_vector_type *u_vtk=NULL)
Definition: domain_disc_impl.h:2270
virtual void init_all_exports(ConstSmartPtr< DoFDistribution > dd, bool bAsTimeDependent)
Definition: domain_disc_impl.h:2112
void InitAllExports(const std::vector< IElemDisc< domain_type > * > &vElemDisc, ConstSmartPtr< DoFDistribution > dd, int si, bool bNonRegularGrid, bool bAsTimeDependent)
Definition: domain_disc_impl.h:2217
void update_elem_discs()
set the approximation space in the elem discs and extract IElemDiscs
Definition: domain_disc_impl.h:68
virtual bool is_error_valid()
returns whether current error values are valid
Definition: domain_disc_impl.h:2841
virtual void invalidate_error()
Definition: domain_disc_impl.h:2826
void AssembleJacobian(const std::vector< IElemDisc< domain_type > * > &vElemDisc, ConstSmartPtr< DoFDistribution > dd, int si, bool bNonRegularGrid, matrix_type &J, const vector_type &u)
Definition: domain_disc_impl.h:615
void AssembleErrorEstimator(const std::vector< IElemError< domain_type > * > &vElemDisc, ConstSmartPtr< DoFDistribution > dd, int si, bool bNonRegularGrid, const vector_type &u)
Definition: domain_disc_impl.h:2533
virtual void finish_timestep(ConstSmartPtr< VectorTimeSeries< vector_type > > vSol, ConstSmartPtr< DoFDistribution > dd)
finishes time step
Definition: domain_disc_impl.h:2853
virtual void prepare_timestep_elem(ConstSmartPtr< VectorTimeSeries< vector_type > > vSol, ConstSmartPtr< DoFDistribution > dd)
prepares time step element-wise
Definition: domain_disc_impl.h:1241
virtual void prepare_timestep(ConstSmartPtr< VectorTimeSeries< vector_type > > vSol, number future_time, ConstSmartPtr< DoFDistribution > dd)
prepares time step
Definition: domain_disc_impl.h:1204
void update_disc_items()
Definition: domain_disc_impl.h:127
void AssembleMassMatrix(const std::vector< IElemDisc< domain_type > * > &vElemDisc, ConstSmartPtr< DoFDistribution > dd, int si, bool bNonRegularGrid, matrix_type &M, const vector_type &u)
Definition: domain_disc_impl.h:271
virtual void assemble_defect(vector_type &d, const vector_type &u, ConstSmartPtr< DoFDistribution > dd)
assembles Defect
Definition: domain_disc_impl.h:648
virtual void mark_with_strategy(IRefiner &refiner, SmartPtr< IElementMarkingStrategy< TDomain > > strategy)
Definition: domain_disc_impl.h:2807
void AssembleRhs(const std::vector< IElemDisc< domain_type > * > &vElemDisc, ConstSmartPtr< DoFDistribution > dd, int si, bool bNonRegularGrid, vector_type &rhs, const vector_type &u)
Definition: domain_disc_impl.h:1124
virtual void assemble_mass_matrix(matrix_type &M, const vector_type &u, ConstSmartPtr< DoFDistribution > dd)
assembles the mass matrix
Definition: domain_disc_impl.h:145
void AssembleDefect(const std::vector< IElemDisc< domain_type > * > &vElemDisc, ConstSmartPtr< DoFDistribution > dd, int si, bool bNonRegularGrid, vector_type &d, const vector_type &u)
Definition: domain_disc_impl.h:804
void AssembleLinear(const std::vector< IElemDisc< domain_type > * > &vElemDisc, ConstSmartPtr< DoFDistribution > dd, int si, bool bNonRegularGrid, matrix_type &A, vector_type &rhs)
Definition: domain_disc_impl.h:965
virtual void assemble_stiffness_matrix(matrix_type &A, const vector_type &u, ConstSmartPtr< DoFDistribution > dd)
assembles the stiffness matrix
Definition: domain_disc_impl.h:305
virtual void assemble_rhs(vector_type &rhs, const vector_type &u, ConstSmartPtr< DoFDistribution > dd)
assembles rhs
Definition: domain_disc_impl.h:998
virtual void assemble_linear(matrix_type &A, vector_type &b, ConstSmartPtr< DoFDistribution > dd)
Assembles Matrix and Right-Hand-Side for a linear problem.
Definition: domain_disc_impl.h:837
void FinishTimestepElem(const std::vector< IElemDisc< domain_type > * > &vElemDisc, ConstSmartPtr< DoFDistribution > dd, int si, bool bNonRegularGrid, ConstSmartPtr< VectorTimeSeries< vector_type > > vSol)
Definition: domain_disc_impl.h:2991
virtual void finish_timestep_elem(ConstSmartPtr< VectorTimeSeries< vector_type > > vSol, ConstSmartPtr< DoFDistribution > dd)
finishes timestep
Definition: domain_disc_impl.h:2889
void AssembleStiffnessMatrix(const std::vector< IElemDisc< domain_type > * > &vElemDisc, ConstSmartPtr< DoFDistribution > dd, int si, bool bNonRegularGrid, matrix_type &A, const vector_type &u)
Definition: domain_disc_impl.h:431
void PrepareTimestepElem(const std::vector< IElemDisc< domain_type > * > &vElemDisc, ConstSmartPtr< DoFDistribution > dd, int si, bool bNonRegularGrid, ConstSmartPtr< VectorTimeSeries< vector_type > > vSol)
Definition: domain_disc_impl.h:1344
virtual void assemble_jacobian(matrix_type &J, const vector_type &u, ConstSmartPtr< DoFDistribution > dd)
assembles Jacobian (or Approximation of Jacobian)
Definition: domain_disc_impl.h:471
void update_error_items()
Definition: domain_disc_impl.h:134
void update_elem_errors()
Definition: domain_disc_impl.h:89
virtual void adjust_solution(vector_type &u, ConstSmartPtr< DoFDistribution > dd)
sets dirichlet values in solution vector
Definition: domain_disc_impl.h:1156
represents numerical solutions on a grid using an algebraic vector
Definition: grid_function.h:121
SmartPtr< TDomain > domain()
returns domain
Definition: grid_function.h:342
SmartPtr< ApproximationSpace< TDomain > > approx_space()
returns approx space
Definition: grid_function.h:348
Definition: grid_level.h:42
@ TOP
Definition: grid_level.h:45
@ SURFACE
Definition: grid_level.h:48
TAlgebra::vector_type vector_type
Type of algebra vector.
Definition: assemble_interface.h:119
TAlgebra::matrix_type matrix_type
Type of algebra matrix.
Definition: assemble_interface.h:116
Definition: elem_disc_interface.h:800
Definition: elem_disc_interface.h:760
Abstract base class for element marking (in adaptive refinement)
Definition: error_elem_marking_strategy.h:125
Base class for error estimator data.
Definition: err_est_data.h:71
bool consider_me() const
virtual function granting get access to the m_consider member
Definition: err_est_data.h:95
The refiner interface allows to mark elements for refinement and to call refine.
Definition: refiner_interface.h:67
Definition: local_algebra.h:50
size_t num_dof(size_t fct) const
number of dofs for accessible function
Definition: local_algebra.h:117
size_t num_fct() const
number of functions
Definition: local_algebra.h:114
Definition: local_algebra.h:198
void resize(const LocalIndices &ind)
resize for current local indices
Definition: local_algebra.h:214
Group of subsets.
Definition: subset_group.h:51
bool regular_grid(size_t i) const
returns if a subset is a regular grid
Definition: subset_group.cpp:224
size_t size() const
number of subsets in this group
Definition: subset_group.h:122
Const iterator to traverse the surface of a multi-grid hierarchy.
Definition: surface_view.h:237
@ ALL
Definition: surface_view.h:102
time series of solutions and corresponding time point
Definition: solution_time_series.h:59
@ PST_ADDITIVE
Definition: parallel_storage_type.h:69
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
std::string ElementDebugInfo(const Grid &grid, GridObject *e)
Returns a string containing information on the given element.
Definition: debug_util.cpp:991
#define UG_CATCH_THROW(msg)
Definition: error.h:64
#define UG_THROW(msg)
Definition: error.h:57
#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
SM_edge_weight_map< typename T::value_type, ug::BidirectionalMatrix< T > > get(edge_weight_t, ug::BidirectionalMatrix< T > const &g)
Definition: bidirectional_boost.h:157
IndexLayout::Interface::iterator find(IndexLayout::Interface &interface, size_t i)
Definition: parallel_index_layout.h:77
@ CT_DIRICHLET
Definition: ass_tuner.h:59
@ CT_HANGING
Definition: ass_tuner.h:57
@ CT_ALL
Definition: ass_tuner.h:60
@ CT_MAY_DEPEND_ON_HANGING
Definition: ass_tuner.h:56
@ CT_ASSEMBLED
Definition: ass_tuner.h:55
@ CT_CONSTRAINTS
Definition: ass_tuner.h:58
void GetElemDiscOnSubset(std::vector< IElemDisc< TDomain > * > &vSubsetElemDisc, const std::vector< IElemDisc< TDomain > * > &vElemDisc, const std::vector< SubsetGroup > &vSSGrp, int si, bool clearVec)
Definition: subset_assemble_util.cpp:40
void CreateSubsetGroups(std::vector< SubsetGroup > &vSSGrp, SubsetGroup &unionSSGrp, std::vector< TElemIn * > vElemDisc, ConstSmartPtr< ISubsetHandler > pSH)
Definition: subset_assemble_util.h:59
static void prep_assemble_loop(std::vector< TElemDisc * > vElemDisc)
Definition: domain_disc_impl.h:49
void CollectIErrEstData(std::vector< IErrEstData< TDomain > * > &vErrEstData, const T &vElemDisc)
Definition: domain_disc_impl.h:2249
void GetLocalVector(LocalVector &lvec, const TVector &vec)
Definition: local_algebra.h:739
int DimensionOfSubset(const ISubsetHandler &sh, int si)
returns the current dimension of the subset
Definition: subset_dim_util.cpp:89
bool SubsetIsRegularGrid(const SubsetHandler &sh, int si)
returns if a subset is a regular grid
Definition: subset_dim_util.cpp:39
void AddLocalVector(TVector &vec, const LocalVector &lvec)
Definition: local_algebra.h:753
static void post_assemble_loop(std::vector< TElemDisc * > vElemDisc)
Definition: domain_disc_impl.h:58
#define PROFILE_FUNC_GROUP(groups)
Definition: profiler.h:258
Definition: domain_traits.h:53