45 template <
typename TElem,
int TWorldDim>
51 for(
size_t ip = 0; ip < num_scvf(); ++ip)
52 UG_LOG(
"#### vSCVF_PosOnEdge = " << vSCVF_PosOnEdge[ip] <<
"\n");
55 for(
size_t i = 0; i < num_scvf(); ++i)
57 UG_LOG(
"ip's: " << m_vSCVF[i].globalIP <<
"\n");
58 UG_LOG(
"normals: " << m_vSCVF[i].Normal <<
"\n");
63 for(
size_t i = 0; i < num_scvf(); ++i)
66 for(
size_t d = 0; d < m_vSCVF[i].globalIP.size(); ++d)
67 m_vSCVF[i].globalIP[d] = 0.5*(vSCVF_PosOnEdge[i][d] + m_MidPoint[d]);
73 VecSubtract(buffer_comp, vSCVF_PosOnEdge[i], m_MidPoint);
76 buffer_copy[0] = -buffer_comp[1];
77 buffer_copy[1] = buffer_comp[0];
81 if (
VecDot(m_vSCVF[i].Normal, buffer_copy) > 0 )
83 UG_LOG(
"Positiv: normals: " << m_vSCVF[i].Normal <<
"\n");
84 UG_LOG(
"Positiv: normals: " << buffer_copy <<
"\n");
86 m_vSCVF[i].Normal[0] = buffer_copy[0];
87 m_vSCVF[i].Normal[1] = buffer_copy[1];
91 UG_LOG(
"Negativ: normals: " << m_vSCVF[i].Normal <<
"\n");
92 UG_LOG(
"Negativ: normals: " << buffer_copy <<
"\n");
94 m_vSCVF[i].Normal[0] = -buffer_copy[0];
95 m_vSCVF[i].Normal[1] = -buffer_copy[1];
99 UG_LOG(
"***ip's: " << m_vSCVF[i].globalIP <<
"\n");
100 UG_LOG(
"***normals: " << m_vSCVF[i].Normal <<
"\n");
101 UG_LOG(
"***buffer_copy: " << buffer_copy <<
"\n");
109 template <
typename TElem,
int TWorldDim>
114 UG_THROW(
"adapt_integration_points: ok done...\n");
118 template <
typename TElem,
int TWorldDim>
127 for(
size_t i = 0; i < num_scvf(); ++i)
129 UG_LOG(
"ip's: " << m_vSCVF[i].globalIP <<
"\n");
130 UG_LOG(
"normals: " << m_vSCVF[i].Normal <<
"\n");
146 template <
int dim,
typename TRefElem,
int maxM
id>
148 const MathVector<dim> vCorner[],
149 MathVector<dim> vvMid[][maxMid])
152 for(
int d = 1; d <=
dim; ++d)
155 for(
size_t i = 0; i < rRefElem.num(d); ++i)
158 const size_t coID0 = rRefElem.id(d, i, 0, 0);
159 vvMid[d][i] = vCorner[coID0];
162 for(
size_t j = 1; j < rRefElem.num(d, i, 0); ++j)
164 const size_t coID = rRefElem.id(d, i, 0, j);
165 vvMid[d][i] += vCorner[coID];
169 vvMid[d][i] *= 1./(rRefElem.num(d, i, 0));
178 VecScaleAdd(vvMid[1][rRefElem.num(1)], 0.5, vCorner[2], 0.5, vCorner[0]);
179 VecScaleAdd(vvMid[1][rRefElem.num(1)+1], 0.5, vCorner[0], 0.5, vCorner[2]);
182 vvMid[2][rRefElem.num(2)] = vCorner[0];
183 vvMid[2][rRefElem.num(2)] += vCorner[1];
184 vvMid[2][rRefElem.num(2)] += vCorner[2];
185 vvMid[2][rRefElem.num(2)] *= 1.0/3.0;
187 vvMid[2][rRefElem.num(2)+1] = vCorner[0];
188 vvMid[2][rRefElem.num(2)+1] += vCorner[2];
189 vvMid[2][rRefElem.num(2)+1] += vCorner[3];
190 vvMid[2][rRefElem.num(2)+1] *= 1.0/3.0;
192 vvMid[2][rRefElem.num(2)+2] = vCorner[0];
193 vvMid[2][rRefElem.num(2)+2] += vCorner[4];
194 vvMid[2][rRefElem.num(2)+2] += vCorner[2];
195 vvMid[2][rRefElem.num(2)+2] *= 1.0/3.0;
197 vvMid[2][rRefElem.num(2)+3] = vCorner[0];
198 vvMid[2][rRefElem.num(2)+3] += vCorner[2];
199 vvMid[2][rRefElem.num(2)+3] += vCorner[4];
200 vvMid[2][rRefElem.num(2)+3] *= 1.0/3.0;
204 vvMid[3][rRefElem.num(3)] = vCorner[0];
205 vvMid[3][rRefElem.num(3)] += vCorner[1];
206 vvMid[3][rRefElem.num(3)] += vCorner[2];
207 vvMid[3][rRefElem.num(3)] += vCorner[4];
208 vvMid[3][rRefElem.num(3)] *= 0.25;
210 vvMid[3][rRefElem.num(3)+1] = vCorner[0];
211 vvMid[3][rRefElem.num(3)+1] += vCorner[2];
212 vvMid[3][rRefElem.num(3)+1] += vCorner[3];
213 vvMid[3][rRefElem.num(3)+1] += vCorner[4];
214 vvMid[3][rRefElem.num(3)+1] *= 0.25;
221 template <
typename TRefElem>
223 MidID vMidID[],
int i)
232 vMidID[0] = MidID(1,i);
237 vMidID[1] = MidID(
dim, 0);
241 vMidID[1] = MidID(2, rRefElem.id(1, i, 2, 0));
242 vMidID[2] = MidID(
dim, 0);
243 vMidID[3] = MidID(2, rRefElem.id(1, i, 2, 1));
253 case 0: vMidID[0] = MidID(1,0);
254 vMidID[1] = MidID(2,5);
255 vMidID[2] = MidID(3,1);
256 vMidID[3] = MidID(2,1);
259 case 1: vMidID[0] = MidID(1,1);
260 vMidID[1] = MidID(2,5);
261 vMidID[2] = MidID(3,1);
262 vMidID[3] = MidID(2,2);
265 case 2: vMidID[0] = MidID(1,8);
266 vMidID[1] = MidID(2,5);
267 vMidID[2] = MidID(3,1);
268 vMidID[3] = MidID(2,7);
271 case 3: vMidID[0] = MidID(1,4);
272 vMidID[1] = MidID(2,1);
273 vMidID[2] = MidID(3,1);
274 vMidID[3] = MidID(2,7);
277 case 4: vMidID[0] = MidID(1,5);
278 vMidID[1] = MidID(2,2);
279 vMidID[2] = MidID(3,1);
280 vMidID[3] = MidID(2,1);
283 case 5: vMidID[0] = MidID(1,6);
284 vMidID[1] = MidID(2,7);
285 vMidID[2] = MidID(3,1);
286 vMidID[3] = MidID(2,2);
289 case 6: vMidID[0] = MidID(1,9);
290 vMidID[1] = MidID(2,6);
291 vMidID[2] = MidID(3,2);
292 vMidID[3] = MidID(2,8);
295 case 7: vMidID[0] = MidID(1,2);
296 vMidID[1] = MidID(2,6);
297 vMidID[2] = MidID(3,2);
298 vMidID[3] = MidID(2,3);
301 case 8: vMidID[0] = MidID(1,3);
302 vMidID[1] = MidID(2,6);
303 vMidID[2] = MidID(3,2);
304 vMidID[3] = MidID(2,4);
307 case 9: vMidID[0] = MidID(1,4);
308 vMidID[1] = MidID(2,8);
309 vMidID[2] = MidID(3,2);
310 vMidID[3] = MidID(2,4);
313 case 10:vMidID[0] = MidID(1,6);
314 vMidID[1] = MidID(2,3);
315 vMidID[2] = MidID(3,2);
316 vMidID[1] = MidID(2,8);
319 case 11:vMidID[0] = MidID(1,7);
320 vMidID[3] = MidID(2,4);
321 vMidID[2] = MidID(3,2);
322 vMidID[1] = MidID(2,3);
324 default:
UG_THROW(
"Pyramid only has 12 SCVFs (no. 0-11), but requested no. " << i <<
".");
333 template <
typename TRefElem>
335 MidID vMidID[],
int i)
343 vMidID[0] = MidID(0, i);
344 vMidID[1] = MidID(
dim, 0);
348 vMidID[0] = MidID(0, i);
349 vMidID[1] = MidID(1, rRefElem.id(0, i, 1, 0));
350 vMidID[2] = MidID(
dim, 0);
351 vMidID[3] = MidID(1, rRefElem.id(0, i, 1, 1));
355 vMidID[0] = MidID(0, i);
356 vMidID[1] = MidID(1, rRefElem.id(0, i, 1, 1));
357 vMidID[2] = MidID(2, rRefElem.id(0, i, 2, 0));
358 vMidID[3] = MidID(1, rRefElem.id(0, i, 1, 0));
359 vMidID[4] = MidID(1, rRefElem.id(0, i, 1, 2));
360 vMidID[5] = MidID(2, rRefElem.id(0, i, 2, 2));
361 vMidID[6] = MidID(
dim, 0);
362 vMidID[7] = MidID(2, rRefElem.id(0, i, 2, 1));
364 else {
UG_THROW(
"Dimension higher that 3 not implemented.");}
372 case 0: vMidID[0] = MidID(0,0);
373 vMidID[1] = MidID(1,0);
374 vMidID[2] = MidID(2,5);
375 vMidID[3] = MidID(1,8);
376 vMidID[4] = MidID(1,4);
377 vMidID[5] = MidID(2,1);
378 vMidID[6] = MidID(3,1);
379 vMidID[7] = MidID(2,7);
382 case 1: vMidID[0] = MidID(0,1);
383 vMidID[1] = MidID(1,1);
384 vMidID[2] = MidID(2,5);
385 vMidID[3] = MidID(1,0);
386 vMidID[4] = MidID(1,5);
387 vMidID[5] = MidID(2,2);
388 vMidID[6] = MidID(3,1);
389 vMidID[7] = MidID(2,1);
392 case 2: vMidID[0] = MidID(0,2);
393 vMidID[1] = MidID(1,8);
394 vMidID[2] = MidID(2,5);
395 vMidID[3] = MidID(1,1);
396 vMidID[4] = MidID(1,6);
397 vMidID[5] = MidID(2,7);
398 vMidID[6] = MidID(3,1);
399 vMidID[7] = MidID(2,2);
402 case 3: vMidID[0] = MidID(0,4);
403 vMidID[1] = MidID(1,5);
404 vMidID[2] = MidID(2,1);
405 vMidID[3] = MidID(1,4);
406 vMidID[4] = MidID(1,6);
407 vMidID[5] = MidID(2,2);
408 vMidID[6] = MidID(3,1);
409 vMidID[7] = MidID(2,7);
412 case 4: vMidID[0] = MidID(0,0);
413 vMidID[1] = MidID(1,9);
414 vMidID[2] = MidID(2,6);
415 vMidID[3] = MidID(1,3);
416 vMidID[4] = MidID(1,4);
417 vMidID[5] = MidID(2,8);
418 vMidID[6] = MidID(3,2);
419 vMidID[7] = MidID(2,4);
422 case 5: vMidID[0] = MidID(0,2);
423 vMidID[1] = MidID(1,2);
424 vMidID[2] = MidID(2,6);
425 vMidID[3] = MidID(1,9);
426 vMidID[4] = MidID(1,6);
427 vMidID[5] = MidID(2,3);
428 vMidID[6] = MidID(3,2);
429 vMidID[7] = MidID(2,8);
432 case 6: vMidID[0] = MidID(0,3);
433 vMidID[1] = MidID(1,3);
434 vMidID[2] = MidID(2,6);
435 vMidID[3] = MidID(1,2);
436 vMidID[4] = MidID(1,7);
437 vMidID[5] = MidID(2,4);
438 vMidID[6] = MidID(3,2);
439 vMidID[7] = MidID(2,3);
442 case 7: vMidID[0] = MidID(0,4);
443 vMidID[1] = MidID(1,6);
444 vMidID[2] = MidID(2,8);
445 vMidID[3] = MidID(1,4);
446 vMidID[4] = MidID(1,7);
447 vMidID[5] = MidID(2,3);
448 vMidID[6] = MidID(3,2);
449 vMidID[7] = MidID(2,4);
451 default:
UG_THROW(
"Pyramid only has 8 SCVs (no. 0-7), but requested no. " << i <<
".");
460 template <
typename TRefElem>
462 MidID vMidID[],
int co)
469 const int coOfSide = rRefElem.num(
dim-1, side, 0);
474 vMidID[co%2] = MidID(0, rRefElem.id(1, side, 0, co));
475 vMidID[(co+1)%2] = MidID(1, side);
479 vMidID[0] = MidID(0, rRefElem.id(2, side, 0, co));
480 vMidID[1] = MidID(1, rRefElem.id(2, side, 1, co));
481 vMidID[2] = MidID(2, side);
482 vMidID[3] = MidID(1, rRefElem.id(2, side, 1, (co -1 + coOfSide)%coOfSide));
491 case 0: vMidID[0] = MidID(0,0);
492 vMidID[1] = MidID(1,8);
493 vMidID[2] = MidID(2,5);
494 vMidID[3] = MidID(1,0);
497 case 1: vMidID[0] = MidID(0,1);
498 vMidID[1] = MidID(1,0);
499 vMidID[2] = MidID(2,5);
500 vMidID[3] = MidID(1,1);
503 case 2: vMidID[0] = MidID(0,2);
504 vMidID[1] = MidID(1,1);
505 vMidID[2] = MidID(2,5);
506 vMidID[3] = MidID(1,8);
509 case 3: vMidID[0] = MidID(0,0);
510 vMidID[1] = MidID(1,3);
511 vMidID[2] = MidID(2,6);
512 vMidID[3] = MidID(1,9);
515 case 4: vMidID[0] = MidID(0,2);
516 vMidID[1] = MidID(1,9);
517 vMidID[2] = MidID(2,6);
518 vMidID[3] = MidID(1,2);
521 case 5: vMidID[0] = MidID(0,3);
522 vMidID[1] = MidID(1,2);
523 vMidID[2] = MidID(2,6);
524 vMidID[3] = MidID(1,3);
526 default:
UG_THROW(
"Pyramid only has 6 BFs on bottom side (no. 0-5), but requested no. " << co <<
".");
532 template <
int dim,
int maxM
id>
534 const MidID vMidID[],
535 MathVector<dim> vvMidPos[][maxMid],
538 for(
size_t i = 0; i < numCo; ++i)
540 const size_t d = vMidID[i].dim;
541 const size_t id = vMidID[i].id;
542 vCorner[i] = vvMidPos[d][id];
550 template <
typename TElem,
int TWorldDim>
559 template <
typename TElem,
int TWorldDim>
564 for(
size_t i = 0; i < m_rRefElem.num(0); ++i)
565 m_vvLocMid[0][i] = m_rRefElem.corner(i);
568 ComputeMidPoints<dim, ref_elem_type, maxMid>(m_rRefElem, m_vvLocMid[0], m_vvLocMid);
571 for(
size_t i = 0; i < num_scvf(); ++i)
577 m_vSCVF[i].From = m_rRefElem.id(1, i, 0, 0);
578 m_vSCVF[i].To = m_rRefElem.id(1, i, 0, 1);
584 m_vSCVF[i].From = ((i>6 && i%3) ? (i%3)+1 : i%3);
585 m_vSCVF[i].To = i%6 > 2 ? 4 : ((i+1)%3 + (i>5 && i<8 ? 1 : 0));
592 CopyCornerByMidID<dim, maxMid>(m_vSCVF[i].vLocPos, m_vSCVF[i].vMidID, m_vvLocMid, SCVF::numCo);
600 for(
size_t i = 0; i < num_scv(); ++i)
605 m_vSCV[i].nodeId = i;
611 m_vSCV[i].nodeId = i<3 ? i : (i<5 ? (i+1)%5 : i-3);
618 CopyCornerByMidID<dim, maxMid>(m_vSCV[i].vLocPos, m_vSCV[i].midId, m_vvLocMid, m_vSCV[i].num_corners());
623 for(
size_t i = 0; i < num_scvf(); ++i)
625 m_rTrialSpace.shapes(&(m_vSCVF[i].vShape[0]), m_vSCVF[i].local_ip());
626 m_rTrialSpace.grads(&(m_vSCVF[i].vLocalGrad[0]), m_vSCVF[i].local_ip());
629 for(
size_t i = 0; i < num_scv(); ++i)
631 m_rTrialSpace.shapes(&(m_vSCV[i].vShape[0]), m_vSCV[i].local_ip());
632 m_rTrialSpace.grads(&(m_vSCV[i].vLocalGrad[0]), m_vSCV[i].local_ip());
636 for(
size_t i = 0; i < num_scvf(); ++i)
637 m_vLocSCVF_IP[i] = scvf(i).local_ip();
641 template <
typename TElem,
int TWorldDim>
646 UG_ASSERT(
dynamic_cast<TElem*
>(elem) != NULL,
"Wrong element type.");
647 TElem* pElem =
static_cast<TElem*
>(elem);
650 if(m_pElem == pElem)
return;
else m_pElem = pElem;
653 for(
size_t i = 0; i < m_rRefElem.num(0); ++i)
654 m_vvGloMid[0][i] = vCornerCoords[i];
657 ComputeMidPoints<worldDim, ref_elem_type, maxMid>(m_rRefElem, m_vvGloMid[0], m_vvGloMid);
660 for(
size_t i = 0; i < num_scvf(); ++i)
663 CopyCornerByMidID<worldDim, maxMid>(m_vSCVF[i].vGloPos, m_vSCVF[i].vMidID, m_vvGloMid, SCVF::numCo);
669 traits::NormalOnSCVF(m_vSCVF[i].Normal, m_vSCVF[i].vGloPos, m_vvGloMid[0]);
673 for(
size_t i = 0; i < num_scv(); ++i)
676 CopyCornerByMidID<worldDim, maxMid>(m_vSCV[i].vGloPos, m_vSCV[i].midId, m_vvGloMid, m_vSCV[i].num_corners());
679 m_vSCV[i].Vol = ElementSize<scv_type, worldDim>(m_vSCV[i].vGloPos);
683 m_mapping.update(vCornerCoords);
689 m_mapping.jacobian_transposed_inverse(JtInv, m_vSCVF[0].local_ip());
690 const number detJ = m_mapping.sqrt_gram_det(m_vSCVF[0].local_ip());
692 for(
size_t i = 0; i < num_scvf(); ++i)
694 m_vSCVF[i].JtInv = JtInv;
695 m_vSCVF[i].detj = detJ;
698 for(
size_t i = 0; i < num_scv(); ++i)
700 m_vSCV[i].JtInv = JtInv;
701 m_vSCV[i].detj = detJ;
707 for(
size_t i = 0; i < num_scvf(); ++i)
709 m_mapping.jacobian_transposed_inverse(m_vSCVF[i].JtInv, m_vSCVF[i].local_ip());
710 m_vSCVF[i].detj = m_mapping.sqrt_gram_det(m_vSCVF[i].local_ip());
712 for(
size_t i = 0; i < num_scv(); ++i)
714 m_mapping.jacobian_transposed_inverse(m_vSCV[i].JtInv, m_vSCV[i].local_ip());
715 m_vSCV[i].detj = m_mapping.sqrt_gram_det(m_vSCV[i].local_ip());
720 for(
size_t i = 0; i < num_scvf(); ++i)
721 for(
size_t sh = 0 ; sh < scvf(i).num_sh(); ++sh)
722 MatVecMult(m_vSCVF[i].vGlobalGrad[sh], m_vSCVF[i].JtInv, m_vSCVF[i].vLocalGrad[sh]);
724 for(
size_t i = 0; i < num_scv(); ++i)
725 for(
size_t sh = 0 ; sh < scv(i).num_sh(); ++sh)
726 MatVecMult(m_vSCV[i].vGlobalGrad[sh], m_vSCV[i].JtInv, m_vSCV[i].vLocalGrad[sh]);
729 for(
size_t i = 0; i < num_scvf(); ++i)
730 m_vGlobSCVF_IP[i] = scvf(i).global_ip();
733 if(num_boundary_subsets() == 0 || ish == NULL)
return;
734 else update_boundary_faces(pElem, vCornerCoords, ish);
739 template <
typename TElem,
int TWorldDim>
743 UG_ASSERT(
dynamic_cast<TElem*
>(elem) != NULL,
"Wrong element type.");
744 TElem* pElem =
static_cast<TElem*
>(elem);
750 std::vector<int> vSubsetIndex;
754 std::vector<Vertex*> vVertex;
756 vSubsetIndex.resize(vVertex.size());
757 for(
size_t i = 0; i < vVertex.size(); ++i)
761 std::vector<Edge*> vEdges;
763 vSubsetIndex.resize(vEdges.size());
764 for(
size_t i = 0; i < vEdges.size(); ++i)
768 std::vector<Face*> vFaces;
770 vSubsetIndex.resize(vFaces.size());
771 for(
size_t i = 0; i < vFaces.size(); ++i)
776 typename std::map<int, std::vector<BF> >::iterator it;
777 for (it=m_mapVectorBF.begin() ; it != m_mapVectorBF.end(); ++it)
780 const int bndIndex = (*it).first;
783 std::vector<BF>& vBF = (*it).second;
792 for(
size_t side = 0; side < vSubsetIndex.size(); ++side)
795 if(vSubsetIndex[side] != bndIndex)
continue;
798 const int coOfSide = (m_rRefElem.REFERENCE_OBJECT_ID !=
ROID_PYRAMID || side != 0)
799 ? m_rRefElem.num(
dim-1, side, 0) : m_rRefElem.num(
dim-1, side, 0) + 2;
802 vBF.resize(curr_bf + coOfSide);
805 for(
int co = 0; co < coOfSide; ++co)
808 BF& bf = vBF[curr_bf];
811 if (m_rRefElem.REFERENCE_OBJECT_ID !=
ROID_PYRAMID || side != 0)
812 bf.
nodeId = m_rRefElem.id(
dim-1, side, 0, co);
816 bf.
nodeId = m_rRefElem.id(
dim-1, side, 0, (co % 3) + (co>3 ? 1 : 0));
823 CopyCornerByMidID<dim, maxMid>(bf.
vLocPos, bf.
vMidID, m_vvLocMid, BF::numCo);
824 CopyCornerByMidID<worldDim, maxMid>(bf.
vGloPos, bf.
vMidID, m_vvGloMid, BF::numCo);
839 m_mapping.jacobian_transposed_inverse(bf.
JtInv, bf.
localIP);
842 for(
size_t sh = 0 ; sh < bf.
num_sh(); ++sh)
856 template <
int TDim,
int TWorldDim>
862 for(
size_t ip = 0; ip < num_scvf(); ++ip)
863 UG_LOG(
"Dim- vSCVF_PosOnEdge = " << vSCVF_PosOnEdge[ip] <<
"\n");
866 for(
size_t i = 0; i < num_scvf(); ++i)
868 UG_LOG(
"Dim-ip's: " << m_vSCVF[i].globalIP <<
"\n");
869 UG_LOG(
"Dim-normals: " << m_vSCVF[i].Normal <<
"\n");
874 for(
size_t i = 0; i < num_scvf(); ++i)
877 for(
size_t d = 0; d < m_vSCVF[i].globalIP.size(); ++d)
878 m_vSCVF[i].globalIP[d] = 0.5*(vSCVF_PosOnEdge[i][d] + m_MidPoint[d]);
884 VecSubtract(buffer_comp, vSCVF_PosOnEdge[i], m_MidPoint);
887 buffer_copy[0] = -buffer_comp[1];
888 buffer_copy[1] = buffer_comp[0];
892 if (
VecDot(m_vSCVF[i].Normal, buffer_copy) > 0 )
894 UG_LOG(
"Dim-Positiv: normals: " << m_vSCVF[i].Normal <<
"\n");
895 UG_LOG(
"Dim-Positiv: normals: " << buffer_copy <<
"\n");
897 m_vSCVF[i].Normal[0] = buffer_copy[0];
898 m_vSCVF[i].Normal[1] = buffer_copy[1];
902 UG_LOG(
"Dim-Negativ: normals: " << m_vSCVF[i].Normal <<
"\n");
903 UG_LOG(
"Dim-Negativ: normals: " << buffer_copy <<
"\n");
905 m_vSCVF[i].Normal[0] = -buffer_copy[0];
906 m_vSCVF[i].Normal[1] = -buffer_copy[1];
910 UG_LOG(
"Dim-***ip's: " << m_vSCVF[i].globalIP <<
"\n");
911 UG_LOG(
"Dim-***normals: " << m_vSCVF[i].Normal <<
"\n");
912 UG_LOG(
"Dim-***buffer_copy: " << buffer_copy <<
"\n");
919 template <
int TDim,
int TWorldDim>
924 UG_THROW(
"adapt_integration_points: ok done...\n");
928 template <
int TDim,
int TWorldDim>
937 for(
size_t i = 0; i < num_scvf(); ++i)
939 UG_LOG(
"ip's: " << m_vSCVF[i].globalIP <<
"\n");
940 UG_LOG(
"normals: " << m_vSCVF[i].Normal <<
"\n");
949 template <
int TDim,
int TWorldDim>
956 = ReferenceElementProvider::get<dim>(m_roid);
959 for(
size_t i = 0; i < rRefElem.
num(0); ++i)
960 m_vvLocMid[0][i] = rRefElem.
corner(i);
963 ComputeMidPoints<dim, DimReferenceElement<dim>, maxMid>
964 (rRefElem, m_vvLocMid[0], m_vvLocMid);
972 for(
size_t i = 0; i < num_scvf(); ++i)
977 m_vSCVF[i].From = rRefElem.
id(1, i, 0, 0);
978 m_vSCVF[i].To = rRefElem.
id(1, i, 0, 1);
984 m_vSCVF[i].From = ((i>6 && i%3) ? (i%3)+1 : i%3);
985 m_vSCVF[i].To = i%6 > 2 ? 4 : ((i+1)%3 + (i>5 && i<8 ? 1 : 0));
993 CopyCornerByMidID<dim, maxMid>(m_vSCVF[i].vLocPos, m_vSCVF[i].vMidID, m_vvLocMid, SCVF::numCo);
1001 for(
size_t i = 0; i < num_scv(); ++i)
1006 m_vSCV[i].nodeId = i;
1012 m_vSCV[i].nodeId = i<3 ? i : (i<5 ? (i+1)%5 : i-3);
1019 CopyCornerByMidID<dim, maxMid>(m_vSCV[i].vLocPos, m_vSCV[i].vMidID, m_vvLocMid, m_vSCV[i].num_corners());
1029 m_nsh = TrialSpace.
num_sh();
1031 for(
size_t i = 0; i < num_scvf(); ++i)
1033 m_vSCVF[i].numSH = TrialSpace.
num_sh();
1034 TrialSpace.
shapes(&(m_vSCVF[i].vShape[0]), m_vSCVF[i].localIP);
1035 TrialSpace.
grads(&(m_vSCVF[i].vLocalGrad[0]), m_vSCVF[i].localIP);
1038 for(
size_t i = 0; i < num_scv(); ++i)
1040 m_vSCV[i].numSH = TrialSpace.
num_sh();
1041 TrialSpace.
shapes(&(m_vSCV[i].vShape[0]), m_vSCV[i].vLocPos[0]);
1042 TrialSpace.
grads(&(m_vSCV[i].vLocalGrad[0]), m_vSCV[i].vLocPos[0]);
1049 for(
size_t i = 0; i < num_scvf(); ++i)
1050 m_vLocSCVF_IP[i] = scvf(i).local_ip();
1055 template <
int TDim,
int TWorldDim>
1060 if(m_pElem == pElem)
return;
else m_pElem = pElem;
1069 update_local_data();
1075 = ReferenceElementProvider::get<dim>(m_roid);
1078 for(
size_t i = 0; i < rRefElem.
num(0); ++i)
1079 m_vvGloMid[0][i] = vCornerCoords[i];
1082 ComputeMidPoints<worldDim, DimReferenceElement<dim>, maxMid>(rRefElem, m_vvGloMid[0], m_vvGloMid);
1085 for(
size_t i = 0; i < num_scvf(); ++i)
1088 CopyCornerByMidID<worldDim, maxMid>(m_vSCVF[i].vGloPos, m_vSCVF[i].vMidID, m_vvGloMid, SCVF::numCo);
1094 traits::NormalOnSCVF(m_vSCVF[i].Normal, m_vSCVF[i].vGloPos, m_vvGloMid[0]);
1098 for(
size_t i = 0; i < num_scv(); ++i)
1101 CopyCornerByMidID<worldDim, maxMid>(m_vSCV[i].vGloPos, m_vSCV[i].vMidID, m_vvGloMid, m_vSCV[i].num_corners());
1104 m_vSCV[i].Vol = ElementSize<scv_type, worldDim>(m_vSCV[i].vGloPos);
1109 rMapping.
update(vCornerCoords);
1119 for(
size_t i = 0; i < num_scvf(); ++i)
1121 m_vSCVF[i].JtInv = JtInv;
1122 m_vSCVF[i].detj = detJ;
1125 for(
size_t i = 0; i < num_scv(); ++i)
1127 m_vSCV[i].JtInv = JtInv;
1128 m_vSCV[i].detj = detJ;
1134 for(
size_t i = 0; i < num_scvf(); ++i)
1137 m_vSCVF[i].detj = rMapping.
sqrt_gram_det(m_vSCVF[i].local_ip());
1139 for(
size_t i = 0; i < num_scv(); ++i)
1142 m_vSCV[i].detj = rMapping.
sqrt_gram_det(m_vSCV[i].local_ip());
1147 for(
size_t i = 0; i < num_scvf(); ++i)
1148 for(
size_t sh = 0; sh < scvf(i).num_sh(); ++sh)
1149 MatVecMult(m_vSCVF[i].vGlobalGrad[sh], m_vSCVF[i].JtInv, m_vSCVF[i].vLocalGrad[sh]);
1151 for(
size_t i = 0; i < num_scv(); ++i)
1152 for(
size_t sh = 0; sh < scv(i).num_sh(); ++sh)
1153 MatVecMult(m_vSCV[i].vGlobalGrad[sh], m_vSCV[i].JtInv, m_vSCV[i].vLocalGrad[sh]);
1156 for(
size_t i = 0; i < num_scvf(); ++i)
1157 m_vGlobSCVF_IP[i] = scvf(i).global_ip();
1163 if(num_boundary_subsets() == 0 || ish == NULL)
return;
1164 else update_boundary_faces(pElem, vCornerCoords, ish);
1167 template <
int TDim,
int TWorldDim>
1175 std::vector<int> vSubsetIndex;
1179 std::vector<Vertex*> vVertex;
1181 vSubsetIndex.resize(vVertex.size());
1182 for(
size_t i = 0; i < vVertex.size(); ++i)
1186 std::vector<Edge*> vEdges;
1188 vSubsetIndex.resize(vEdges.size());
1189 for(
size_t i = 0; i < vEdges.size(); ++i)
1193 std::vector<Face*> vFaces;
1195 vSubsetIndex.resize(vFaces.size());
1196 for(
size_t i = 0; i < vFaces.size(); ++i)
1202 = ReferenceElementProvider::get<dim>(m_roid);
1205 rMapping.
update(vCornerCoords);
1211 typename std::map<int, std::vector<BF> >::iterator it;
1212 for (it=m_mapVectorBF.begin() ; it != m_mapVectorBF.end(); ++it)
1215 const int bndIndex = (*it).first;
1218 std::vector<BF>& vBF = (*it).second;
1227 for(
size_t side = 0; side < vSubsetIndex.size(); ++side)
1230 if(vSubsetIndex[side] != bndIndex)
continue;
1234 ? rRefElem.
num(
dim-1, side, 0) : rRefElem.
num(
dim-1, side, 0) + 2;
1236 vBF.resize(curr_bf + coOfSide);
1239 for(
int co = 0; co < coOfSide; ++co)
1242 BF& bf = vBF[curr_bf];
1250 bf.
nodeId = rRefElem.
id(
dim-1, side, 0, (co % 3) + (co>3 ? 1 : 0));
1257 CopyCornerByMidID<dim, maxMid>(bf.
vLocPos, bf.
vMidID, m_vvLocMid, BF::numCo);
1258 CopyCornerByMidID<worldDim, maxMid>(bf.
vGloPos, bf.
vMidID, m_vvGloMid, BF::numCo);
1280 for(
size_t sh = 0 ; sh < bf.
num_sh(); ++sh)
boundary face
Definition: fv1ib_geom.h:836
MathVector< dim > vLocPos[numCo]
Definition: fv1ib_geom.h:914
size_t nodeId
Definition: fv1ib_geom.h:908
number Vol
Definition: fv1ib_geom.h:922
number detj
Definition: fv1ib_geom.h:930
MathVector< worldDim > vGlobalGrad[maxNSH]
Definition: fv1ib_geom.h:928
MathVector< dim > vLocalGrad[maxNSH]
Definition: fv1ib_geom.h:927
size_t numSH
Definition: fv1ib_geom.h:925
size_t num_sh() const
number of shape functions
Definition: fv1ib_geom.h:869
MathVector< worldDim > globalIP
Definition: fv1ib_geom.h:920
MathVector< worldDim > Normal
Definition: fv1ib_geom.h:921
number vShape[maxNSH]
Definition: fv1ib_geom.h:926
MidID vMidID[numCo]
Definition: fv1ib_geom.h:916
MathVector< dim > localIP
Definition: fv1ib_geom.h:919
MathVector< worldDim > vGloPos[numCo]
Definition: fv1ib_geom.h:915
MathMatrix< worldDim, dim > JtInv
Definition: fv1ib_geom.h:929
Geometry and shape functions for 1st order Vertex-Centered Finite Volume.
Definition: fv1ib_geom.h:598
void adapt_integration_points(GridObject *elem, const MathVector< TWorldDim > *vCornerCoords, const ISubsetHandler *ish=NULL)
adapt integration points for elements cut by the inner boundary
Definition: fv1ib_geom_impl.h:921
void update_local_data()
update local data
Definition: fv1ib_geom_impl.h:951
void update(GridObject *elem, const MathVector< worldDim > *vCornerCoords, const ISubsetHandler *ish=NULL)
update data for given element
Definition: fv1ib_geom_impl.h:1057
void adapt(GridObject *elem, const MathVector< TWorldDim > *vCornerCoords, const ISubsetHandler *ish=NULL)
adapt integration points for elements cut by the inner boundary
Definition: fv1ib_geom_impl.h:858
void adapt_normals(GridObject *elem, const MathVector< TWorldDim > *vCornerCoords, const ISubsetHandler *ish=NULL)
adapt normals for elements cut by the inner boundary
Definition: fv1ib_geom_impl.h:930
void update_boundary_faces(GridObject *elem, const MathVector< worldDim > *vCornerCoords, const ISubsetHandler *ish=NULL)
update boundary data for given element
Definition: fv1ib_geom_impl.h:1169
const MathVector< dim > & corner(size_t i) const
coordinates of reference corner (i = 0 ... num(0))
Definition: reference_element.h:192
virtual number sqrt_gram_det(const MathVector< dim > &locPos) const =0
returns the determinate of the jacobian
virtual number jacobian_transposed_inverse(MathMatrix< worldDim, dim > &JTInv, const MathVector< dim > &locPos) const =0
returns transposed of the inverse of the jacobian and returns sqrt of gram determinante
virtual void update(const MathVector< worldDim > *vCornerCoord)=0
refresh mapping for new set of corners
virtual bool is_linear() const =0
returns if mapping is affine
boundary face
Definition: fv1ib_geom.h:324
MathVector< worldDim > vGloPos[numCo]
Definition: fv1ib_geom.h:403
size_t num_sh() const
number of shape functions
Definition: fv1ib_geom.h:357
MathMatrix< worldDim, dim > JtInv
Definition: fv1ib_geom.h:416
MathVector< worldDim > Normal
Definition: fv1ib_geom.h:409
MathVector< dim > vLocalGrad[nsh]
Definition: fv1ib_geom.h:414
MidID vMidID[numCo]
Definition: fv1ib_geom.h:404
number detj
Definition: fv1ib_geom.h:417
MathVector< dim > localIP
Definition: fv1ib_geom.h:407
size_t nodeId
Definition: fv1ib_geom.h:396
MathVector< worldDim > globalIP
Definition: fv1ib_geom.h:408
number Vol
Definition: fv1ib_geom.h:410
number vShape[nsh]
Definition: fv1ib_geom.h:413
MathVector< dim > vLocPos[numCo]
Definition: fv1ib_geom.h:402
MathVector< worldDim > vGlobalGrad[nsh]
Definition: fv1ib_geom.h:415
Geometry and shape functions for 1st order Vertex-Centered Finite Volume.
Definition: fv1ib_geom.h:69
reference_element_traits< TElem >::reference_element_type ref_elem_type
type of reference element
Definition: fv1ib_geom.h:75
void update_local_data()
update local data
Definition: fv1ib_geom_impl.h:561
void update(GridObject *elem, const MathVector< worldDim > *vCornerCoords, const ISubsetHandler *ish=NULL)
update data for given element
Definition: fv1ib_geom_impl.h:643
void update_boundary_faces(GridObject *elem, const MathVector< worldDim > *vCornerCoords, const ISubsetHandler *ish=NULL)
update boundary data for given element
Definition: fv1ib_geom_impl.h:741
Manages the elements of a grid and their interconnection.
Definition: grid.h:132
The base class for all geometric objects, such as vertices, edges, faces, volumes,...
Definition: grid_base_objects.h:157
virtual ReferenceObjectID reference_object_id() const =0
Definition: subset_handler_interface.h:223
Grid * grid() const
returns a pointer to the grid on which the subset-handler works.
Definition: subset_handler_interface.cpp:304
int get_subset_index(GridObject *elem) const
Definition: subset_handler_interface.cpp:560
Identifier for Local Finite Elements.
Definition: local_finite_element_id.h:98
@ LAGRANGE
Definition: local_finite_element_id.h:104
Lagrange shape functions of first order.
Definition: lagrangep1.h:55
virtual size_t num_sh() const
Definition: local_dof_set.cpp:46
virtual base class for local shape function sets
Definition: local_shape_function_set.h:70
virtual void grads(grad_type *vGrad, const MathVector< dim > &x) const =0
returns all gradients evaluated at a point
virtual void shapes(shape_type *vShape, const MathVector< dim > &x) const =0
returns all shape functions evaluated at a point
a mathematical Vector with N entries.
Definition: math_vector.h:97
Provider, holding a single instance of an object.
Definition: provider.h:48
size_t num(int dim) const
returns the number of geometric objects of dim
Definition: reference_element.h:95
int id(int dim_i, size_t i, int dim_j, size_t j) const
id of object j in dimension dim_j of obj i in dimension dim_i
Definition: reference_element.h:127
Definition: reference_mapping.h:65
static void ComputeSCVMidID(const TRefElem &rRefElem, MidID vMidID[], int i)
Definition: fv1ib_geom_impl.h:334
static void ComputeBFMidID(const TRefElem &rRefElem, int side, MidID vMidID[], int co)
Definition: fv1ib_geom_impl.h:461
static void ComputeSCVFMidID(const TRefElem &rRefElem, MidID vMidID[], int i)
Definition: fv1ib_geom_impl.h:222
static void ComputeMidPoints(const TRefElem &rRefElem, const MathVector< dim > vCorner[], MathVector< dim > vvMid[][maxMid])
Definition: fv1ib_geom_impl.h:147
static void CopyCornerByMidID(MathVector< dim > vCorner[], const MidID vMidID[], MathVector< dim > vvMidPos[][maxMid], const size_t numCo)
Definition: fv1ib_geom_impl.h:533
void CollectEdgesSorted(vector< Edge * > &vEdgesOut, Grid &grid, Vertex *v, bool clearContainer)
Collects all edges of a vertex, thus, none.
Definition: grid_util.cpp:205
void CollectFacesSorted(vector< Face * > &vFacesOut, Grid &grid, Vertex *v, bool clearContainer)
Collects all Faces of a Vertex, thus, none.
Definition: grid_util.cpp:401
void CollectVertices(std::vector< Vertex * > &vVertexOut, Grid &grid, Vertex *v, bool clearContainer)
Collects all vertices.
Definition: grid_util.cpp:141
#define UG_ASSERT(expr, msg)
Definition: assert.h:70
#define UG_CATCH_THROW(msg)
Definition: error.h:64
#define UG_THROW(msg)
Definition: error.h:57
#define UG_LOG(msg)
Definition: log.h:367
double number
Definition: types.h:124
void MatVecMult(vector_t_out &vOut, const matrix_t &m, const vector_t_in &v)
Matrix - Vector Multiplication.
Definition: math_matrix_vector_functions_common_impl.hpp:49
void VecScaleAdd(vector_t &vOut, typename vector_t::value_type s1, const vector_t &v1, typename vector_t::value_type s2, const vector_t &v2)
Scales two Vectors, adds them and returns the sum in a third vector.
Definition: math_vector_functions_common_impl.hpp:265
void VecSubtract(vector_t &vOut, const vector_t &v1, const vector_t &v2)
subtracts v2 from v1 and stores the result in a vOut
Definition: math_vector_functions_common_impl.hpp:226
vector_t::value_type VecTwoNorm(const vector_t &v)
Definition: math_vector_functions_common_impl.hpp:577
vector_t::value_type VecDot(const vector_t &v1, const vector_t &v2)
returns the dot-product of two vector_ts
Definition: math_vector_functions_common_impl.hpp:385
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
ReferenceObjectID
these ids are used to identify the shape of a geometric object.
Definition: grid_base_objects.h:74
@ ROID_PYRAMID
Definition: grid_base_objects.h:83
static void ComputeBFMidID(const TRefElem &rRefElem, int side, MidID vMidID[], int co)
Definition: fv1_geom.cpp:204
static void ComputeSCVMidID(const TRefElem &rRefElem, MidID vMidID[], int i)
Definition: fv1_geom.cpp:156
void AveragePositions(TPosition &vOut, const TPosition *vCornerCoords, size_t num)
averages positions by arithmetic mean
Definition: fv_util.h:59
static void ComputeSCVFMidID(const TRefElem &rRefElem, MidID vMidID[], int i)
Definition: fv1_geom.cpp:118