33 #ifndef __H__UG__NAVIER_STOKES__INCOMPRESSIBLE__FILTER__IMPL__
34 #define __H__UG__NAVIER_STOKES__INCOMPRESSIBLE__FILTER__IMPL__
41 template<
typename VType,
typename TElem,
typename TDomain,
typename TGr
idFunction>
47 for(
int si = 0; si < domain.subset_handler()->num_subsets(); ++si)
49 for (
int j=0;j<(int)walls.size();j++)
if ((
int)si == (int)walls[j].si())
continue;
50 ElemIterator elemIter = uInfo->template begin<TElem>(si);
51 ElemIterator elemIterEnd = uInfo->template end<TElem>(si);
52 for( ;elemIter !=elemIterEnd; elemIter++)
54 TElem* elem = *elemIter;
55 if (pbm && pbm->
is_slave(elem))
continue;
56 acUHat[elem]/=(
number)acVolume[elem];
61 template <
typename vector_t>
71 m = std::max(m, std::abs(v1[i]-v2[i]) );
77 template<
typename TGr
idFunction>
79 typedef typename TGridFunction::const_element_iterator const_iterator;
82 = u->domain()->position_accessor();
83 number averageElemSize = 0;
84 std::vector<MathVector<dim> > vCorner;
86 const_iterator iter = m_uInfo->template begin<elem_type>();
87 const_iterator iterEnd = m_uInfo->template end<elem_type>();
88 for(; iter != iterEnd; ++iter)
93 averageElemSize += ElementSize<dim>(roid, &vCorner[0]);
96 return averageElemSize/(
number)nrOfElem;
99 template <
typename TGr
idFunction>
100 template <
typename VType>
106 std::vector<side_type*>& sides
110 typedef typename grid_type::template traits<side_type>::secure_container side_secure_container;
114 side_secure_container assoSides;
115 size_t startIndex = sides.size()-1;
119 for (
size_t k=1;k<
s->num_vertices();k++){
120 bary += posAcc[
s->vertex(k)];
122 bary /=
s->num_vertices();
124 for (
size_t w=0;w<m_walls.size();w++){
125 width = std::min(width,m_walls[w].dist(bary));
127 for (
size_t k=0;k<coord.size();k++){
131 acVolume[
s]+=volumes[k];
132 acUHat[
s]+=values[k];
136 for (
size_t i=startIndex;i<sides.size();i++){
137 for (
size_t v=0;v<sides[i]->num_vertices();v++){
138 domain.grid()->associated_elements(assoSides,sides[i]->vertex(v));
139 for (
size_t j=0;j<assoSides.size();j++){
143 for (
int k=sides.size()-1;k>=0;k--){
149 if (isNew==
false)
continue;
151 bary = posAcc[
s->vertex(0)];
152 for (
size_t k=1;k<
s->num_vertices();k++){
153 bary += posAcc[
s->vertex(k)];
155 bary /=
s->num_vertices();
157 for (
size_t w=0;w<m_walls.size();w++){
158 width = std::min(width,m_walls[w].dist(bary));
162 for (
size_t k=0;k<coord.size();k++){
164 if (dist<0.5*m_width) inside=
true;
167 acVolume[
s]+=volumes[k];
168 acUHat[
s]+=values[k];
174 if (inside==
true) sides.push_back(
s);
181 template <
typename TGr
idFunction>
182 template <
typename VType>
185 bool useGridFunction;
186 if (u==
SPNULL) useGridFunction =
false;
else useGridFunction =
true;
189 SetAttachmentValues(m_acSideVolume, domain.grid()->template begin<side_type>(), domain.grid()->template end<side_type>(), 0);
190 SetAttachmentValues(acUHat, domain.grid()->template begin<side_type>(), domain.grid()->template end<side_type>(), 0);
192 std::vector<DoFIndex> multInd;
200 typedef typename grid_type::template traits<side_type>::secure_container side_secure_container;
201 side_secure_container elemsides;
204 for(
int si = 0; si < domain.subset_handler()->
num_subsets(); ++si)
207 ElemIterator iter = m_uInfo->template begin<elem_type>(si);
208 ElemIterator iterEnd = m_uInfo->template end<elem_type>(si);
211 for( ;iter !=iterEnd; ++iter)
217 size_t noc=elem->num_vertices();
218 for(
size_t i = 0; i < noc; ++i)
219 coCoord[i] = posAcc[elem->vertex(i)];
222 domain.grid()->associated_elements_sorted(elemsides,
static_cast<elem_type*
>(elem) );
225 geo.
update(elem, &(coCoord[0]), domain.subset_handler().get());
236 std::vector< MathVector<dim> > baryCoords(geo.
num_scv());
237 std::vector<side_type*> sides;
239 std::vector< Region<dim> > regions(1);
240 regions[0].firstIndex=0;
241 regions[0].periodicOffset=0;
244 for (
size_t i=0;i<geo.
num_scv();i++){
246 baryCoords.resize(geo.
num_scv());
256 std::vector<number> vShape;
257 rTrialSpace.
shapes(vShape, scvLocalBary);
260 size_t nos=elemsides.size();
263 for (
size_t sh=0;sh<nos;sh++){
266 for (
size_t d=0;d<
dim;d++){
267 u->dof_indices(elemsides[sh], d, multInd);
268 assignVal(localValue,d,
DoFRef(*u,multInd[0]));
271 localValue = acU[elemsides[sh]];
272 localValue *= vShape[sh];
273 values[i] += localValue;
275 values[i] *= scv.
volume();
276 volumes[i] = scv.
volume();
279 sides.push_back(elemsides[0]);
280 collectSides(acUHat,m_acSideVolume,baryCoords,values,volumes,sides);
284 for (
size_t i=0;i<sides.size();i++){
293 for (
size_t j=0;j<sides.size();j++){
300 sides.push_back(sNew);
303 if (regions.size()==0)
306 for (regInd=regions.size()-1; ;regInd--){
307 if (i>regions[regInd].firstIndex)
break;
308 if (regInd==0)
break;
314 for (
size_t k=1;k<sNew->num_vertices();k++){
315 sReg0Co += posAcc[
s->vertex(k)];
316 sReg1Co += posAcc[sNew->vertex(k)];
318 sReg0Co/=
s->num_vertices();
319 sReg1Co/=sNew->num_vertices();
321 for (
size_t k=0;k<
dim;k++){
322 pOffset[k] = regions[regInd].periodicOffset[k]+sReg0Co[k]-sReg1Co[k];
325 size_t rsize = regions.
size();
326 regions.resize(rsize+1);
327 regions[rsize].firstIndex=sides.size()-1;
328 regions[rsize].periodicOffset=pOffset;
329 std::vector< MathVector<dim> > baryCoordsNew(geo.
num_scv());
330 for (
size_t k=0;k<baryCoordsNew.size();k++){
331 for (
size_t d0=0;d0<
dim;d0++){
332 baryCoordsNew[k][d0] = baryCoords[k][d0]-pOffset[d0];
336 collectSides(acUHat,m_acSideVolume,baryCoordsNew,values,volumes,sides);
344 if (useGridFunction) copyWallData(acUHat,u,m_walls);
345 else copyWallData(acUHat,acU,m_uInfo,m_walls);
346 if (
dim==2) constrainingSideAveraging<TGridFunction,side_type,ConstrainingEdge,VType>(acUHat,m_uInfo);
348 constrainingSideAveraging<TGridFunction,side_type,ConstrainingTriangle,VType>(acUHat,m_uInfo);
349 constrainingSideAveraging<TGridFunction,side_type,ConstrainingQuadrilateral,VType>(acUHat,m_uInfo);
354 template<
typename TGr
idFunction>
356 typedef typename TGridFunction::const_element_iterator const_iterator;
359 = u->domain()->position_accessor();
360 number averageElemSize = 0;
361 std::vector<MathVector<dim> > vCorner;
363 const_iterator iter = m_uInfo->template begin<elem_type>();
364 const_iterator iterEnd = m_uInfo->template end<elem_type>();
365 for(; iter != iterEnd; ++iter)
370 averageElemSize += ElementSize<dim>(roid, &vCorner[0]);
373 return averageElemSize/(
number)nrOfElem;
376 template <
typename TGr
idFunction>
377 template <
typename VType>
383 std::vector<side_type*>& sides
387 typedef typename grid_type::template traits<side_type>::secure_container side_secure_container;
389 std::vector<DoFIndex> multInd;
392 side_secure_container assoSides;
393 size_t startIndex = sides.size()-1;
397 for (
size_t k=1;k<
s->num_vertices();k++){
398 bary += posAcc[
s->vertex(k)];
400 bary /=
s->num_vertices();
401 m_width->inner_dof_indices(
s,0, multInd);
403 for (
size_t w=0;w<m_walls.size();w++){
404 localwidth = std::min(localwidth,m_walls[w].dist(bary));
406 for (
size_t k=0;k<coord.size();k++){
408 if (dist<0.5*localwidth){
410 acVolume[
s]+=volumes[k];
411 acUHat[
s]+=values[k];
415 for (
size_t i=startIndex;i<sides.size();i++){
416 for (
size_t v=0;v<sides[i]->num_vertices();v++){
417 domain.grid()->associated_elements(assoSides,sides[i]->vertex(v));
418 for (
size_t j=0;j<assoSides.size();j++){
422 for (
int k=sides.size()-1;k>=0;k--){
428 if (isNew==
false)
continue;
430 bary = posAcc[
s->vertex(0)];
431 for (
size_t k=1;k<
s->num_vertices();k++){
432 bary += posAcc[
s->vertex(k)];
434 bary /=
s->num_vertices();
436 m_width->inner_dof_indices(
s,0, multInd);
437 localwidth=0.5*
DoFRef(*m_width,multInd[0]);
438 for (
size_t w=0;w<m_walls.size();w++){
439 localwidth = std::min(localwidth,m_walls[w].dist(bary));
443 for (
size_t k=0;k<coord.size();k++){
445 if (dist<0.5*localwidth){
447 acVolume[
s]+=volumes[k];
448 acUHat[
s]+=values[k];
451 if (dist<0.5*m_maxwidth) inside=
true;
454 if (inside==
true) sides.push_back(
s);
461 template <
typename TGr
idFunction>
462 template <
typename VType>
465 bool useGridFunction;
466 if (u==
SPNULL) useGridFunction =
false;
else useGridFunction =
true;
469 SetAttachmentValues(m_acSideVolume, domain.grid()->template begin<side_type>(), domain.grid()->template end<side_type>(), 0);
470 SetAttachmentValues(acUHat, domain.grid()->template begin<side_type>(), domain.grid()->template end<side_type>(), 0);
472 std::vector<DoFIndex> multInd;
480 typedef typename grid_type::template traits<side_type>::secure_container side_secure_container;
481 side_secure_container elemsides;
484 for(
int si = 0; si < domain.subset_handler()->
num_subsets(); ++si)
487 ElemIterator iter = m_uInfo->template begin<elem_type>(si);
488 ElemIterator iterEnd = m_uInfo->template end<elem_type>(si);
491 for( ;iter !=iterEnd; ++iter)
497 size_t noc=elem->num_vertices();
498 for(
size_t i = 0; i < noc; ++i)
499 coCoord[i] = posAcc[elem->vertex(i)];
502 domain.grid()->associated_elements_sorted(elemsides,
static_cast<elem_type*
>(elem) );
505 geo.
update(elem, &(coCoord[0]), domain.subset_handler().get());
516 std::vector< MathVector<dim> > baryCoords(geo.
num_scv());
517 std::vector<side_type*> sides;
519 std::vector< Region<dim> > regions(1);
520 regions[0].firstIndex=0;
521 regions[0].periodicOffset=0;
524 for (
size_t i=0;i<geo.
num_scv();i++){
526 baryCoords.resize(geo.
num_scv());
536 std::vector<number> vShape;
537 rTrialSpace.
shapes(vShape, scvLocalBary);
540 size_t nos=elemsides.size();
543 for (
size_t sh=0;sh<nos;sh++){
546 for (
size_t d=0;d<
dim;d++){
547 u->dof_indices(elemsides[sh], d, multInd);
548 assignVal(localValue,d,
DoFRef(*u,multInd[0]));
551 localValue = acU[elemsides[sh]];
552 localValue *= vShape[sh];
553 values[i] += localValue;
555 values[i] *= scv.
volume();
556 volumes[i] = scv.
volume();
559 sides.push_back(elemsides[0]);
560 collectSides(acUHat,m_acSideVolume,baryCoords,values,volumes,sides);
564 for (
size_t i=0;i<sides.size();i++){
573 for (
size_t j=0;j<sides.size();j++){
580 sides.push_back(sNew);
583 if (regions.size()==0)
586 for (regInd=regions.size()-1; ;regInd--){
587 if (i>regions[regInd].firstIndex)
break;
588 if (regInd==0)
break;
594 for (
size_t k=1;k<sNew->num_vertices();k++){
595 sReg0Co += posAcc[
s->vertex(k)];
596 sReg1Co += posAcc[sNew->vertex(k)];
598 sReg0Co/=
s->num_vertices();
599 sReg1Co/=sNew->num_vertices();
601 for (
size_t k=0;k<
dim;k++){
602 pOffset[k] = regions[regInd].periodicOffset[k]+sReg0Co[k]-sReg1Co[k];
605 size_t rsize = regions.
size();
606 regions.resize(rsize+1);
607 regions[rsize].firstIndex=sides.size()-1;
608 regions[rsize].periodicOffset=pOffset;
609 std::vector< MathVector<dim> > baryCoordsNew(geo.
num_scv());
610 for (
size_t k=0;k<baryCoordsNew.size();k++){
611 for (
size_t d0=0;d0<
dim;d0++){
612 baryCoordsNew[k][d0] = baryCoords[k][d0]-pOffset[d0];
616 collectSides(acUHat,m_acSideVolume,baryCoordsNew,values,volumes,sides);
624 if (useGridFunction) copyWallData(acUHat,u,m_walls);
625 else copyWallData(acUHat,acU,m_uInfo,m_walls);
626 if (
dim==2) constrainingSideAveraging<TGridFunction,side_type,ConstrainingEdge,VType>(acUHat,m_uInfo);
628 constrainingSideAveraging<TGridFunction,side_type,ConstrainingTriangle,VType>(acUHat,m_uInfo);
629 constrainingSideAveraging<TGridFunction,side_type,ConstrainingQuadrilateral,VType>(acUHat,m_uInfo);
634 template <
typename TGr
idFunction>
635 template <
typename VType>
638 bool useGridFunction =
true;
639 if (u==
SPNULL) useGridFunction =
false;
643 SetAttachmentValues(m_acVertexVolume, domain.grid()->template begin<vertex_type>(), domain.grid()->template end<vertex_type>(), 0);
644 SetAttachmentValues(acUHat, domain.grid()->template begin<vertex_type>(), domain.grid()->template end<vertex_type>(), 0);
646 std::vector<DoFIndex> multInd;
655 for(
int si = 0; si < domain.subset_handler()->
num_subsets(); ++si)
658 ElemIterator iter = m_uInfo->template begin<elem_type>(si);
659 ElemIterator iterEnd = m_uInfo->template end<elem_type>(si);
662 for( ;iter !=iterEnd; ++iter)
668 size_t noc=elem->num_vertices();
669 for(
size_t i = 0; i < noc; ++i)
670 coCoord[i] = posAcc[elem->vertex(i)];
673 geo.
update(elem, &(coCoord[0]), domain.subset_handler().get());
682 for (
size_t i=0;i<geo.
num_scv();i++){
691 std::vector<number> vShape;
692 rTrialSpace.
shapes(vShape, scvLocalBary);
696 for (
size_t sh=0;sh<noc;sh++){
699 for (
size_t d=0;d<
dim;d++){
700 u->dof_indices(elem->vertex(sh), d, multInd);
701 assignVal(localValue,d,
DoFRef(*u,multInd[0]));
704 localValue = acU[elem->vertex(sh)];
705 localValue *= vShape[sh];
709 m_acVertexVolume[elem->vertex(node)] += scv.
volume();
710 acUHat[elem->vertex(node)] += value;
715 if (useGridFunction) copyWallData(acUHat,u,m_walls);
716 else copyWallData(acUHat,acU,m_uInfo,m_walls);
720 template <
typename TGr
idFunction>
725 SetAttachmentValues(m_acVertexVolume, domain.grid()->template begin<vertex_type>(), domain.grid()->template end<vertex_type>(), 0);
733 for(
int si = 0; si < domain.subset_handler()->
num_subsets(); ++si)
736 ElemIterator iter = m_uInfo->template begin<elem_type>(si);
737 ElemIterator iterEnd = m_uInfo->template end<elem_type>(si);
740 for( ;iter !=iterEnd; ++iter)
746 size_t noc=elem->num_vertices();
747 for(
size_t i = 0; i < noc; ++i)
748 coCoord[i] = posAcc[elem->vertex(i)];
751 geo.
update(elem, &(coCoord[0]), domain.subset_handler().get());
753 for (
size_t i=0;i<geo.
num_scv();i++){
756 m_acVertexVolume[elem->vertex(node)] += scv.
volume();
763 template <
typename TGr
idFunction>
767 SetAttachmentValues(m_acSideVolume, domain.grid()->template begin<side_type>(), domain.grid()->template end<side_type>(), 0);
774 typedef typename grid_type::template traits<side_type>::secure_container side_secure_container;
775 side_secure_container sides;
778 for(
int si = 0; si < domain.subset_handler()->
num_subsets(); ++si)
781 ElemIterator iter = m_uInfo->template begin<elem_type>(si);
782 ElemIterator iterEnd = m_uInfo->template end<elem_type>(si);
785 for( ;iter !=iterEnd; ++iter)
791 size_t noc=elem->num_vertices();
792 for(
size_t i = 0; i < noc; ++i)
793 coCoord[i] = posAcc[elem->vertex(i)];
796 domain.grid()->associated_elements_sorted(sides,
static_cast<elem_type*
>(elem) );
799 geo.
update(elem, &(coCoord[0]), domain.subset_handler().get());
801 for (
size_t i=0;i<geo.
num_scv();i++){
805 for (
size_t j=0;j<sides.size();j++){
807 for (
size_t sco=0;sco<sidej->num_vertices();sco++){
808 if (
VecDistance(coCoord[node],posAcc[sidej->vertex(sco)])<1e-12){
809 m_acSideVolume[sidej] += scv.
volume();
820 template <
typename TGr
idFunction>
821 template <
typename VType>
824 bool useGridFunction =
true;
825 if (u==
SPNULL) useGridFunction =
false;
829 SetAttachmentValues(m_acSideVolume, domain.grid()->template begin<side_type>(), domain.grid()->template end<side_type>(), 0);
830 SetAttachmentValues(acUHat, domain.grid()->template begin<side_type>(), domain.grid()->template end<side_type>(), 0);
832 std::vector<DoFIndex> multInd;
840 typedef typename grid_type::template traits<side_type>::secure_container side_secure_container;
841 side_secure_container sides;
844 for(
int si = 0; si < domain.subset_handler()->
num_subsets(); ++si)
847 ElemIterator iter = m_uInfo->template begin<elem_type>(si);
848 ElemIterator iterEnd = m_uInfo->template end<elem_type>(si);
851 for( ;iter !=iterEnd; ++iter)
857 size_t noc=elem->num_vertices();
858 for(
size_t i = 0; i < noc; ++i)
859 coCoord[i] = posAcc[elem->vertex(i)];
862 domain.grid()->associated_elements_sorted(sides,
static_cast<elem_type*
>(elem) );
865 geo.
update(elem, &(coCoord[0]), domain.subset_handler().get());
874 for (
size_t i=0;i<geo.
num_scv();i++){
883 std::vector<number> vShape;
884 rTrialSpace.
shapes(vShape, scvLocalBary);
887 size_t nos=sides.size();
891 for (
size_t sh=0;sh<nos;sh++){
894 for (
size_t d=0;d<
dim;d++){
895 u->dof_indices(sides[sh], d, multInd);
896 assignVal(localValue,d,
DoFRef(*u,multInd[0]));
899 localValue = acU[sides[sh]];
900 localValue *= vShape[sh];
905 for (
size_t j=0;j<nos;j++){
907 for (
size_t sco=0;sco<sidej->num_vertices();sco++){
908 if (
VecDistance(coCoord[node],posAcc[sidej->vertex(sco)])<1e-12){
909 m_acSideVolume[sidej] += scv.
volume();
910 acUHat[sidej] += value;
918 if (useGridFunction) copyWallData(acUHat,u,m_walls);
919 else copyWallData(acUHat,acU,m_uInfo,m_walls);
920 if (
dim==2) constrainingSideAveraging<TGridFunction,side_type,ConstrainingEdge,VType>(acUHat,m_uInfo);
922 constrainingSideAveraging<TGridFunction,side_type,ConstrainingTriangle,VType>(acUHat,m_uInfo);
923 constrainingSideAveraging<TGridFunction,side_type,ConstrainingQuadrilateral,VType>(acUHat,m_uInfo);
928 template <
typename TGr
idFunction>
929 template <
typename VType>
932 bool useGridFunction =
true;
933 if (u==
SPNULL) useGridFunction =
false;
937 SetAttachmentValues(m_acSideVolume, domain.grid()->template begin<side_type>(), domain.grid()->template end<side_type>(), 0);
938 SetAttachmentValues(acUHat, domain.grid()->template begin<side_type>(), domain.grid()->template end<side_type>(), 0);
940 std::vector<DoFIndex> multInd;
948 typedef typename grid_type::template traits<side_type>::secure_container side_secure_container;
949 side_secure_container sides;
952 for(
int si = 0; si < domain.subset_handler()->
num_subsets(); ++si)
955 ElemIterator iter = m_uInfo->template begin<elem_type>(si);
956 ElemIterator iterEnd = m_uInfo->template end<elem_type>(si);
959 for( ;iter !=iterEnd; ++iter)
965 size_t noc=elem->num_vertices();
966 for(
size_t i = 0; i < noc; ++i)
967 coCoord[i] = posAcc[elem->vertex(i)];
970 domain.grid()->associated_elements_sorted(sides,
static_cast<elem_type*
>(elem) );
973 geo.
update(elem, &(coCoord[0]), domain.subset_handler().get());
982 for (
size_t i=0;i<geo.
num_scv();i++){
991 std::vector<number> vShape;
992 rTrialSpace.
shapes(vShape, scvLocalBary);
994 size_t nos=sides.size();
998 for (
size_t sh=0;sh<nos;sh++){
1000 if (useGridFunction)
1001 for (
size_t d=0;d<
dim;d++){
1002 u->dof_indices(sides[sh], d, multInd);
1003 assignVal(localValue,d,
DoFRef(*u,multInd[0]));
1006 localValue = acU[sides[sh]];
1007 localValue *= vShape[sh];
1008 value += localValue;
1011 m_acSideVolume[sides[sidei]] += scv.
volume();
1012 acUHat[sides[sidei]] += value;
1017 if (useGridFunction) copyWallData(acUHat,u,m_walls);
1018 else copyWallData(acUHat,acU,m_uInfo,m_walls);
1019 if (
dim==2) constrainingSideAveraging<TGridFunction,side_type,ConstrainingEdge,VType>(acUHat,m_uInfo);
1021 constrainingSideAveraging<TGridFunction,side_type,ConstrainingTriangle,VType>(acUHat,m_uInfo);
1022 constrainingSideAveraging<TGridFunction,side_type,ConstrainingQuadrilateral,VType>(acUHat,m_uInfo);
1026 template <
typename TGr
idFunction>
1031 SetAttachmentValues(m_acSideVolume, domain.grid()->template begin<side_type>(), domain.grid()->template end<side_type>(), 0);
1039 typedef typename grid_type::template traits<side_type>::secure_container side_secure_container;
1040 side_secure_container sides;
1043 for(
int si = 0; si < domain.subset_handler()->
num_subsets(); ++si)
1046 ElemIterator iter = m_uInfo->template begin<elem_type>(si);
1047 ElemIterator iterEnd = m_uInfo->template end<elem_type>(si);
1050 for( ;iter !=iterEnd; ++iter)
1056 size_t noc=elem->num_vertices();
1057 for(
size_t i = 0; i < noc; ++i)
1058 coCoord[i] = posAcc[elem->vertex(i)];
1061 domain.grid()->associated_elements_sorted(sides,
static_cast<elem_type*
>(elem) );
1064 geo.
update(elem, &(coCoord[0]), domain.subset_handler().get());
1066 for (
size_t i=0;i<geo.
num_scv();i++){
1069 m_acSideVolume[sides[sidei]] += scv.
volume();
1075 template <
typename TGr
idFunction>
1079 SetAttachmentValues(m_acVertexVolume, domain.grid()->template begin<vertex_type>(), domain.grid()->template end<vertex_type>(), 0);
1087 for(
int si = 0; si < domain.subset_handler()->
num_subsets(); ++si)
1090 ElemIterator iter = m_uInfo->template begin<elem_type>(si);
1091 ElemIterator iterEnd = m_uInfo->template end<elem_type>(si);
1094 for( ;iter !=iterEnd; ++iter)
1100 size_t noc=elem->num_vertices();
1101 for(
size_t i = 0; i < noc; ++i)
1102 coCoord[i] = posAcc[elem->vertex(i)];
1105 geo.
update(elem, &(coCoord[0]), domain.subset_handler().get());
1107 for (
size_t i=0;i<geo.
num_scv();i++){
1109 for (
size_t node=0;node<elem->num_vertices();node++){
1110 m_acVertexVolume[elem->vertex(node)] += scv.
volume();
1118 template <
typename TGr
idFunction>
1119 template <
typename VType>
1122 bool useGridFunction =
true;
1123 if (u==
SPNULL) useGridFunction =
false;
1127 SetAttachmentValues(m_acVertexVolume, domain.grid()->template begin<vertex_type>(), domain.grid()->template end<vertex_type>(), 0);
1128 SetAttachmentValues(acUHat, domain.grid()->template begin<vertex_type>(), domain.grid()->template end<vertex_type>(), 0);
1130 std::vector<DoFIndex> multInd;
1139 for(
int si = 0; si < domain.subset_handler()->
num_subsets(); ++si)
1142 ElemIterator iter = m_uInfo->template begin<elem_type>(si);
1143 ElemIterator iterEnd = m_uInfo->template end<elem_type>(si);
1146 for( ;iter !=iterEnd; ++iter)
1152 size_t noc=elem->num_vertices();
1153 for(
size_t i = 0; i < noc; ++i)
1154 coCoord[i] = posAcc[elem->vertex(i)];
1157 geo.
update(elem, &(coCoord[0]), domain.subset_handler().get());
1166 for (
size_t i=0;i<geo.
num_scv();i++){
1174 std::vector<number> vShape;
1175 rTrialSpace.
shapes(vShape, scvLocalBary);
1179 for (
size_t sh=0;sh<noc;sh++){
1181 if (useGridFunction)
1182 for (
size_t d=0;d<
dim;d++){
1183 u->dof_indices(elem->vertex(sh), d, multInd);
1184 assignVal(localValue,d,
DoFRef(*u,multInd[0]));
1187 localValue = acU[elem->vertex(sh)];
1188 localValue *= vShape[sh];
1189 value += localValue;
1192 for (
size_t node=0;node<elem->num_vertices();node++){
1193 m_acVertexVolume[elem->vertex(node)] += scv.
volume();
1194 acUHat[elem->vertex(node)] += value;
1200 if (useGridFunction) copyWallData(acUHat,u,m_walls);
1201 else copyWallData(acUHat,acU,m_uInfo,m_walls);
1205 template <
typename TGr
idFunction>
1209 SetAttachmentValues(m_acSideVolume, domain.grid()->template begin<side_type>(), domain.grid()->template end<side_type>(), 0);
1216 typedef typename grid_type::template traits<side_type>::secure_container side_secure_container;
1217 side_secure_container sides;
1220 for(
int si = 0; si < domain.subset_handler()->
num_subsets(); ++si)
1223 ElemIterator iter = m_uInfo->template begin<elem_type>(si);
1224 ElemIterator iterEnd = m_uInfo->template end<elem_type>(si);
1227 for( ;iter !=iterEnd; ++iter)
1233 size_t noc=elem->num_vertices();
1234 for(
size_t i = 0; i < noc; ++i)
1235 coCoord[i] = posAcc[elem->vertex(i)];
1238 domain.grid()->associated_elements(sides,
static_cast<elem_type*
>(elem) );
1241 geo.
update(elem, &(coCoord[0]), domain.subset_handler().get());
1243 for (
size_t i=0;i<geo.
num_scv();i++){
1246 for (
size_t j=0;j<sides.size();j++){
1247 m_acSideVolume[sides[j]] += scv.
volume();
1256 template <
typename TGr
idFunction>
1257 template <
typename VType>
1260 bool useGridFunction =
true;
1261 if (u==
SPNULL) useGridFunction =
false;
1265 SetAttachmentValues(m_acSideVolume, domain.grid()->template begin<side_type>(), domain.grid()->template end<side_type>(), 0);
1266 SetAttachmentValues(acUHat, domain.grid()->template begin<side_type>(), domain.grid()->template end<side_type>(), 0);
1268 std::vector<DoFIndex> multInd;
1276 typedef typename grid_type::template traits<side_type>::secure_container side_secure_container;
1277 side_secure_container sides;
1280 for(
int si = 0; si < domain.subset_handler()->
num_subsets(); ++si)
1283 ElemIterator iter = m_uInfo->template begin<elem_type>(si);
1284 ElemIterator iterEnd = m_uInfo->template end<elem_type>(si);
1287 for( ;iter !=iterEnd; ++iter)
1293 size_t noc=elem->num_vertices();
1294 for(
size_t i = 0; i < noc; ++i)
1295 coCoord[i] = posAcc[elem->vertex(i)];
1298 domain.grid()->associated_elements_sorted(sides,
static_cast<elem_type*
>(elem) );
1301 geo.
update(elem, &(coCoord[0]), domain.subset_handler().get());
1310 for (
size_t i=0;i<geo.
num_scv();i++){
1318 std::vector<number> vShape;
1319 rTrialSpace.
shapes(vShape, scvLocalBary);
1321 size_t nos=sides.size();
1325 for (
size_t sh=0;sh<nos;sh++){
1327 if (useGridFunction)
1328 for (
size_t d=0;d<
dim;d++){
1329 u->dof_indices(sides[sh], d, multInd);
1330 assignVal(localValue,d,
DoFRef(*u,multInd[0]));
1333 localValue = acU[sides[sh]];
1334 localValue *= vShape[sh];
1335 value += localValue;
1338 for (
size_t j=0;j<sides.size();j++){
1339 m_acSideVolume[sides[j]] += scv.
volume();
1340 acUHat[sides[j]] += value;
1346 if (useGridFunction) copyWallData(acUHat,u,m_walls);
1347 else copyWallData(acUHat,acU,m_uInfo,m_walls);
1348 if (
dim==2) constrainingSideAveraging<TGridFunction,side_type,ConstrainingEdge,VType>(acUHat,m_uInfo);
1350 constrainingSideAveraging<TGridFunction,side_type,ConstrainingTriangle,VType>(acUHat,m_uInfo);
1351 constrainingSideAveraging<TGridFunction,side_type,ConstrainingQuadrilateral,VType>(acUHat,m_uInfo);
function NavierStokes(fcts, subsets, discType)
size_t num_corners() const
const MathVector< dim > & local_corner(size_t co) const
const SCV & scv(size_t i) const
void update(GridObject *elem, const MathVector< worldDim > *vCornerCoords, const ISubsetHandler *ish=NULL)
const MathVector< worldDim > & global_corner(size_t co) const
const MathVector< dim > & local_corner(size_t co) const
size_t num_corners() const
const SCV & scv(size_t i) const
void update(GridObject *elem, const MathVector< worldDim > *vCornerCoords, const ISubsetHandler *ish=NULL)
virtual void shapes(std::vector< std::vector< shape_type > > &vvShape, const std::vector< MathVector< dim > > &vLocPos) const=0
domain_type::position_accessor_type position_accessor_type
Definition: filter.h:408
number compute_average_element_size(SmartPtr< TGridFunction > u)
Definition: filter_impl.h:78
void apply_filter(PeriodicAttachmentAccessor< side_type, Attachment< VType > > &aaUHat, SmartPtr< TGridFunction > u, PeriodicAttachmentAccessor< side_type, Attachment< VType > > &aaU)
Definition: filter_impl.h:183
TGridFunction::template dim_traits< dim >::const_iterator ElemIterator
element iterator
Definition: filter.h:411
void collectSides(PeriodicAttachmentAccessor< side_type, Attachment< VType > > &acUHat, PeriodicAttachmentAccessor< side_type, Attachment< number > > &acVolume, std::vector< MathVector< dim > > &coord, VType values[DimFV1Geometry< dim >::maxNumSCV], number volumes[DimFV1Geometry< dim >::maxNumSCV], std::vector< side_type * > &sides)
Definition: filter_impl.h:101
void compute_filterwidth_fvcr()
Definition: filter_impl.h:1206
void apply_filter(PeriodicAttachmentAccessor< side_type, Attachment< VType > > &aaUHat, SmartPtr< TGridFunction > u, PeriodicAttachmentAccessor< side_type, Attachment< VType > > &aaU)
Definition: filter_impl.h:1258
void compute_filterwidth_fv1()
Definition: filter_impl.h:1076
TGridFunction::template dim_traits< dim >::const_iterator ElemIterator
Definition: filter.h:976
domain_type::position_accessor_type position_accessor_type
Definition: filter.h:973
void compute_filterwidth_fvcr()
Definition: filter_impl.h:764
domain_type::position_accessor_type position_accessor_type
Definition: filter.h:738
void apply_filter(PeriodicAttachmentAccessor< side_type, Attachment< VType > > &aaUHat, SmartPtr< TGridFunction > u, PeriodicAttachmentAccessor< side_type, Attachment< VType > > &aaU)
Definition: filter_impl.h:822
TGridFunction::template dim_traits< dim >::const_iterator ElemIterator
Definition: filter.h:741
void compute_filterwidth_fv1()
Definition: filter_impl.h:721
domain_type::position_accessor_type position_accessor_type
Definition: filter.h:856
void apply_filter(PeriodicAttachmentAccessor< side_type, Attachment< VType > > &aaUHat, SmartPtr< TGridFunction > u, PeriodicAttachmentAccessor< side_type, Attachment< VType > > &aaU)
Definition: filter_impl.h:930
TGridFunction::template dim_traits< dim >::const_iterator ElemIterator
Definition: filter.h:859
void compute_filterwidth_fvcr()
Definition: filter_impl.h:1027
TGridFunction::domain_type domain_type
domain type
Definition: filter.h:137
TGridFunction::template dim_traits< dim >::grid_base_object elem_type
element type
Definition: filter.h:134
elem_type::side side_type
side type
Definition: filter.h:143
number compute_average_element_size(SmartPtr< TGridFunction > u)
Definition: filter_impl.h:355
TGridFunction::template dim_traits< dim >::const_iterator ElemIterator
element iterator
Definition: filter.h:546
void collectSides(PeriodicAttachmentAccessor< side_type, Attachment< VType > > &acUHat, PeriodicAttachmentAccessor< side_type, Attachment< number > > &acVolume, std::vector< MathVector< dim > > &coord, VType values[DimFV1Geometry< dim >::maxNumSCV], number volumes[DimFV1Geometry< dim >::maxNumSCV], std::vector< side_type * > &sides)
Definition: filter_impl.h:378
domain_type::position_accessor_type position_accessor_type
Definition: filter.h:543
void apply_filter(PeriodicAttachmentAccessor< side_type, Attachment< VType > > &aaUHat, SmartPtr< TGridFunction > u, PeriodicAttachmentAccessor< side_type, Attachment< VType > > &aaU)
Definition: filter_impl.h:463
bool is_master(TElem *) const
Group< TElem >::SlaveContainer * slaves(TElem *e) const
TElem * master(TElem *e) const
bool is_slave(TElem *) const
Grid::VertexAttachmentAccessor< position_attachment_type > position_accessor_type
void CollectCornerCoordinates(int base_object_id, std::vector< typename TDomain::position_type > &vCornerCoordsOut, GridObject &elem, const TDomain &domain, bool clearContainer)
size_t num_subsets() const
void SetAttachmentValues(TAttachmentAccessor &aaVal, TIter elemsBegin, TIter elemsEnd, const TVal &val)
const NullSmartPtr SPNULL
vector_t::value_type VecDistance(const vector_t &v1, const vector_t &v2)
vector_t::value_type VecDistanceMaxNorm(const vector_t &v1, const vector_t &v2)
Definition: filter_impl.h:64
void averageByVolume(PeriodicAttachmentAccessor< TElem, Attachment< VType > > &acUHat, PeriodicAttachmentAccessor< TElem, Attachment< number > > &acVolume, TDomain &domain, SmartPtr< TGridFunction > uInfo, std::vector< WallObject< TGridFunction > > walls)
Definition: filter_impl.h:42
const number & DoFRef(const TMatrix &mat, const DoFIndex &iInd, const DoFIndex &jInd)
geometry_traits< TElem >::const_iterator const_iterator