16 static LoggerPtr logger(Logger::getLogger(
"pz.mesh.geoblend"));
23 TGeo::LowerDimensionSides(side,LowAllSides);
24 if(side < 0 || side > TGeo::NSides-1)
31 if(side >= TGeo::NNodes && fNeighbours[side-TGeo::NNodes].ElementIndex() != -1)
36 for(
int lowside = 0; lowside < LowAllSides.
NElements(); lowside++)
38 if(LowAllSides[lowside] >= TGeo::NNodes && fNeighbours[LowAllSides[lowside]-TGeo::NNodes].ElementIndex() != -1)
49 if(fNeighbours[side-TGeo::NNodes].ElementIndex() == index){
50 fNeighbours[side-TGeo::NNodes].SetElementIndex(-1);
59 if(!(fNeighbours[side-TGeo::NNodes].ElementIndex() != -1))
61 fNeighbours[side-TGeo::NNodes] = neigh;
62 fTrans[side - TGeo::NNodes] = trans;
67 if(logger->isWarnEnabled())
70 std::stringstream mess;
71 mess <<
"Trying to SetNeighbourInfo for an already set element\n";
72 mess <<
"* this * = " << __PRETTY_FUNCTION__ <<
"\n";
74 mess <<
"* neigh * = \n";
89 const auto VAL_WIDTH = 10;
90 std::ostringstream soutLogDebug;
91 if(logger->isDebugEnabled())
92 { soutLogDebug<<
"======================_______REF_1"<<std::endl;
93 soutLogDebug <<
"TPZGeoBlend<" <<
MElementType_Name(TGeo::Type())<<
">::GradX"<<std::endl;
94 soutLogDebug <<
"element id " <<gel.
Id()<<std::endl;
95 soutLogDebug <<
"xi: ";
96 for(
int i = 0; i < xiInterior.
size(); i++) soutLogDebug<<std::setw(VAL_WIDTH) << std::right<<xiInterior[i]<<
"\t";
97 soutLogDebug<<std::endl;
100 const REAL zero = 1e-14;
101 gradx.
Redim(3,TGeo::Dimension);
103 if (fNeighbours[TGeo::NSides - 1 -TGeo::NNodes].ElementIndex() != -1){
106 if (!MapToNeighSide(TGeo::NSides-1, TGeo::Dimension, xiInterior, neighXi, dNeighXiDXi)) {
108 if(logger->isDebugEnabled()) {
109 std::stringstream sout;
110 sout <<
"MapToNeighSide is singular for par " << xi <<
" and side " << TGeo::NSides-1 <<
". Aborting...";
117 Neighbour(TGeo::NSides-1, gmesh).GradX(neighXi, gradNeigh);
118 gradNeigh.
Multiply(dNeighXiDXi,gradx);
128 TGeo::TShape(xiInterior, phi, dPhiDxi);
132 for (
int iNode = 0; iNode < TGeo::NNodes; iNode++) {
133 for(
int x = 0; x < 3; x++) {
134 for (
int xi = 0; xi < TGeo::Dimension; xi++) {
135 gradXLin(x, xi) += coord(x, iNode) * dPhiDxi(xi, iNode);
139 for(
int i = 0; i < gradx.
Rows(); i++){
140 for(
int j = 0; j < gradx.
Cols(); j++){
141 gradx(i,j) = gradXLin(i,j);
146 soutLogDebug<<
"FIRST TERM"<<std::endl;
147 soutLogDebug <<
"gradient of linear mapping:\n";
148 if (logger->isDebugEnabled()) {
149 for (
int i = 0; i < gradXLin.
Rows(); i++) {
150 for (
int j = 0; j < gradXLin.
Cols(); j++) {
151 soutLogDebug << std::setw(VAL_WIDTH) << std::right << gradXLin(i, j);
152 if (j != gradXLin.Cols() - 1) soutLogDebug <<
"\t";
154 soutLogDebug << std::endl;
168 TPZFNMatrix<27,T> dCorrFactorDxi(TGeo::NSides - TGeo::NNodes, TGeo::Dimension, (T) 0);
171 for (
int sideIndex = 0; sideIndex < TGeo::NSides - TGeo::NNodes - 1; sideIndex++) {
173 TPZFMatrix<T> &gradNonLinSide = gradNonLinSideVec[sideIndex];
175 gradLinSide.
Redim(3,TGeo::Dimension);
176 gradNonLinSide.
Redim(3,TGeo::Dimension);
178 int side = TGeo::NNodes + sideIndex;
181 if (logger->isDebugEnabled()) {
182 soutLogDebug <<
"================================" << std::endl;
183 soutLogDebug <<
"side: " << side <<
" is linear: ";
186 if (IsLinearMapping(side) || !gelside.
Exists()) {
187 blendFactor[sideIndex] = 0;
189 if (logger->isDebugEnabled()) {
190 if (IsLinearMapping(side)) soutLogDebug <<
"true" << std::endl;
191 else soutLogDebug <<
"false (no gelside) " << std::endl;
197 if (logger->isDebugEnabled()) {
198 soutLogDebug <<
"false (gelside exists) " << std::endl;
206 bool regularMap = TGeo::CheckProjectionForSingularity(side, xiInterior);
209 if (logger->isDebugEnabled()) {
210 soutLogDebug <<
"mapping is not regular. skipping side... ";
217 this->MapToSide(side, xiInterior, sideXi, transfXiToSideXi);
220 const int sideDim = TGeo::SideDimension(side);
222 dSidePhiDSideXiVec(sideDim, nSideNodes);
223 GetSideShapeFunction<TGeo>(side, sideXi, sidePhiVec, dSidePhiDSideXiVec);
226 dXiProjectedOverSideDxi(TGeo::Dimension,TGeo::Dimension,(T)0);
231 for (
int iNode = 0; iNode < nSideNodes; iNode++) {
232 const int currentNode = TGeo::SideNodeLocId(side, iNode);
234 for (
int x = 0; x < 3; x++) {
235 linearSideMappings(sideIndex, x) +=
236 coord(x, currentNode) * sidePhiVec(iNode, 0);
239 TGeo::ParametricDomainNodeCoord(currentNode, nodeCoord);
240 for (
int x = 0; x < TGeo::Dimension; x++) {
241 xiProjectedOverSide[x] += nodeCoord[x] * sidePhiVec(iNode, 0);
244 for(
int x = 0; x < 3; x++){
245 for(
int xi = 0; xi < sideDim; xi++) {
246 gradLinSideXiSide(x,xi) += coord(x, currentNode) * dSidePhiDSideXiVec(xi,iNode);
250 for (
int i = 0; i < TGeo::Dimension; i++) {
251 for (
int j = 0; j < sideDim; j++) {
252 dXprojDxiSide(i,j) += nodeCoord[i] * dSidePhiDSideXiVec(j,iNode);
258 gradLinSideXiSide.
Multiply(transfXiToSideXi,gradLinSide);
259 dXprojDxiSide.Multiply(transfXiToSideXi,dXiProjectedOverSideDxi);
262 if (logger->isDebugEnabled()) {
263 soutLogDebug <<
"xi projection over side: ";
264 for (
int x = 0; x < TGeo::Dimension; x++) soutLogDebug << xiProjectedOverSide[x] <<
"\t";
265 soutLogDebug <<
"\nGrad of projected point to side:\n";
266 for(
int i = 0; i < dXiProjectedOverSideDxi.Rows(); i++){
267 for(
int j = 0; j < dXiProjectedOverSideDxi.Cols(); j++){
268 soutLogDebug<<std::setw(VAL_WIDTH) << std::right<<dXiProjectedOverSideDxi(i,j);
269 if(j != dXiProjectedOverSideDxi.Cols() - 1) soutLogDebug<<
"\t";
271 soutLogDebug<<std::endl;
273 soutLogDebug << std::endl <<
"xi projection in side domain:";
274 for (
int x = 0; x < sideXi.size(); x++) soutLogDebug << sideXi[x] <<
"\t";
275 soutLogDebug <<
"\nTransformation from x side to xi interior:\n";
276 for(
int i = 0; i < transfXiToSideXi.
Rows(); i++){
277 for(
int j = 0; j < transfXiToSideXi.
Cols(); j++){
278 soutLogDebug<<std::setw(VAL_WIDTH) << std::right<<transfXiToSideXi(i,j);
279 if(j != transfXiToSideXi.Cols() - 1) soutLogDebug<<
"\t";
281 soutLogDebug<<std::endl;
283 soutLogDebug << std::endl <<
"\nLinear mapping of projected point: ";
284 for (
int x = 0; x < 3; x++) soutLogDebug << linearSideMappings(sideIndex, x) <<
"\t";
285 soutLogDebug <<
"\nGrad of linear mapping of point projected to side:\n";
286 for(
int i = 0; i < gradLinSide.
Rows(); i++){
287 for(
int j = 0; j < gradLinSide.
Cols(); j++){
288 soutLogDebug<<std::setw(VAL_WIDTH) << std::right<<gradLinSide(i,j);
289 if(j != gradLinSide.Cols() - 1) soutLogDebug<<
"\t";
291 soutLogDebug<<std::endl;
300 TGeo::BlendFactorForSide(side, xiInterior, blendFactor[sideIndex], dCorrFactor);
301 for(
int iXi = 0; iXi < TGeo::Dimension; iXi++){
302 dCorrFactorDxi(sideIndex,iXi) = dCorrFactor[iXi];
309 if (!MapToNeighSide(side, sidedim, xiInterior, neighXi, dNeighXiDXi)) {
311 if(logger->isDebugEnabled()) {
312 std::stringstream sout;
313 sout <<
"MapToNeighSide is singular for par " << par <<
" and side " << byside <<
" skipping the side ";
320 Neighbour(side, gmesh).X(neighXi, Xside);
322 Neighbour(side, gmesh).GradX(neighXi,gradNeigh);
323 for (
int x = 0; x < 3; x++) {
324 nonLinearSideMappings(sideIndex, x) = Xside[x];
326 gradNeigh.
Multiply(dNeighXiDXi,gradNonLinSide);
330 TGeo::LowerDimensionSides(side, containedNodesInSide, 0);
333 TGeo::LowerDimensionSides(side, allContainedSides);
334 for (
int subSideIndex = containedNodesInSide.
NElements();
335 subSideIndex < allContainedSides.
NElements(); subSideIndex++) {
337 const int subSide = allContainedSides[subSideIndex];
339 if (logger->isDebugEnabled()) {
340 soutLogDebug <<
"\tSubside " << subSideIndex <<
" (global: " << subSide <<
") is linear: ";
341 if (IsLinearMapping(subSide)) soutLogDebug <<
"true" << std::endl;
342 else soutLogDebug <<
"false" << std::endl;
345 if (IsLinearMapping(subSide))
continue;
347 T blendFactorSide = -1;
350 TGeo::BlendFactorForSide(subSide, xiProjectedOverSide, blendFactorSide, dCorrFactorSideDxiProj);
353 if (logger->isDebugEnabled()) {
354 soutLogDebug <<
"\tSubside influence :" << blendFactorSide << std::endl;
358 for(
int xi = 0; xi < TGeo::Dimension; xi++){
359 dCorrFactorSideDxiProjMat(0,xi) = dCorrFactorSideDxiProj[xi];
366 dCorrFactorSideDxiProjMat.
Multiply(dXiProjectedOverSideDxi,dCorrFactorSideDxi);
368 if (logger->isDebugEnabled()) {
369 soutLogDebug <<
"\n\tGrad of correction factor of point projected to side:\n";
370 for(
int i = 0; i < dCorrFactorSideDxi.
Rows(); i++){
372 for(
int j = 0; j < dCorrFactorSideDxi.
Cols(); j++){
373 soutLogDebug<<std::setw(VAL_WIDTH) << std::right<<dCorrFactorSideDxi(i,j);
374 if(j != dCorrFactorSideDxi.Cols() - 1) soutLogDebug<<
"\t";
376 soutLogDebug<<std::endl;
380 TPZFMatrix<T> &gradNonLinSubSide = gradNonLinSideVec[subSide - TGeo::NNodes];
381 TPZFMatrix<T> &gradLinSubSide = gradLinSideVec[subSide - TGeo::NNodes];
382 for (
int x = 0; x < 3; x++) {
383 nonLinearSideMappings(sideIndex, x) -=
385 (nonLinearSideMappings(subSide - TGeo::NNodes, x) -
386 linearSideMappings(subSide - TGeo::NNodes, x));
387 for (
int j = 0; j < TGeo::Dimension; j++) {
388 gradNonLinSide(x,j) -= blendFactorSide * (gradNonLinSubSide(x,j)-gradLinSubSide(x,j));
389 gradNonLinSide(x,j) -= dCorrFactorSideDxi(0,j) *
390 (nonLinearSideMappings(subSide - TGeo::NNodes, x) -
391 linearSideMappings(subSide - TGeo::NNodes, x));
397 if (logger->isDebugEnabled()) {
398 soutLogDebug <<
"Non-linear mapping: ";
399 for (
int x = 0; x < 3; x++) soutLogDebug << nonLinearSideMappings(sideIndex, x) <<
"\t";
400 soutLogDebug <<
"\nGrad of non-linear mapping:\n";
401 for(
int i = 0; i < gradNonLinSide.
Rows(); i++){
402 for(
int j = 0; j < gradNonLinSide.
Cols(); j++){
403 soutLogDebug<<std::setw(VAL_WIDTH) << std::right<<gradNonLinSide(i,j);
404 if(j != gradNonLinSide.Cols() - 1) soutLogDebug<<
"\t";
406 soutLogDebug<<std::endl;
408 soutLogDebug << std::endl;
409 soutLogDebug <<
"adding to result mapping of side: " << side << std::endl;
410 soutLogDebug <<
"\t\tcorrection factor: " << blendFactor[sideIndex] << std::endl;
411 soutLogDebug <<
"\t\tdCorrFactorDxi: ";
412 for(
int i = 0; i < TGeo::Dimension; i++) soutLogDebug<<dCorrFactorDxi(sideIndex,i)<<
"\t";
413 soutLogDebug <<
"\n";
415 soutLogDebug<<
"SECOND TERM (SIDE "<<sideIndex<<
") :"<<std::endl;
416 soutLogDebug <<
"\t\tblendFactor * (gradNonLinSide-gradLinSide): " << std::endl;
417 for (
int i = 0; i < 3; i++) {
418 for (
int j = 0; j < TGeo::Dimension; j++) {
419 const T
val = blendFactor[sideIndex] * (gradNonLinSide(i,j)-gradLinSide(i,j));
420 soutLogDebug<<std::setw(VAL_WIDTH) << std::right<<
val;
421 if(j != TGeo::Dimension - 1) soutLogDebug<<
"\t";
423 soutLogDebug <<
"\n";
425 soutLogDebug<<
"THIRD TERM (SIDE "<<sideIndex<<
") :"<<std::endl;
426 soutLogDebug <<
"\t\tdCorrFactorDxi *\n" 427 " (nonLinearSideMappings -\n" 428 " linearSideMappings): " << std::endl;
429 for (
int i = 0; i < 3; i++) {
430 for (
int j = 0; j < TGeo::Dimension; j++) {
431 const T
val = dCorrFactorDxi(sideIndex,j) *
432 (nonLinearSideMappings(sideIndex, i) -
433 linearSideMappings(sideIndex,i));
434 soutLogDebug<<std::setw(VAL_WIDTH) << std::right<<
val;
435 if(j != TGeo::Dimension - 1) soutLogDebug<<
"\t";
437 soutLogDebug <<
"\n";
440 soutLogDebug<<std::endl;
444 for (
int i = 0; i < 3; i++) {
445 for (
int j = 0; j < TGeo::Dimension; j++) {
446 gradx(i,j) += blendFactor[sideIndex] * (gradNonLinSide(i,j)-gradLinSide(i,j));
447 gradx(i,j) += dCorrFactorDxi(sideIndex,j) *
448 (nonLinearSideMappings(sideIndex, i) -
449 linearSideMappings(sideIndex,i));
454 if(logger->isDebugEnabled()){
455 soutLogDebug <<
"================================" <<std::endl;
456 soutLogDebug <<
"=============result=============" <<std::endl;
457 soutLogDebug <<
"================================"<<std::endl;
458 for(
int i = 0; i < gradx.
Rows(); i++){
459 for(
int j = 0; j < gradx.
Cols(); j++){
460 soutLogDebug<<std::setw(VAL_WIDTH) << std::right<<gradx(i,j);
461 if(j != gradx.Cols() - 1) soutLogDebug<<
"\t";
463 soutLogDebug<<std::endl;
465 soutLogDebug <<
"================================" <<std::endl;
466 soutLogDebug <<
"================================" <<std::endl;
467 soutLogDebug <<
"================================" <<std::endl;
469 soutLogDebug.str(
"");
473 for(
int i = 0; i < gradx.
Rows();i++){
474 for(
int j = 0; j < gradx.
Cols(); j++) {
494 std::ostringstream soutLogDebug;
495 if(logger->isDebugEnabled())
497 soutLogDebug <<
"TPZGeoBlend<" <<
MElementType_Name(TGeo::Type())<<
">::X2_______REF_1"<<std::endl;
498 soutLogDebug <<
"element id " <<gel.
Id()<<std::endl;
499 soutLogDebug <<
"xi: ";
500 for(
int i = 0; i < xi.
size(); i++) soutLogDebug<<xi[i]<<
"\n";
501 soutLogDebug<<std::endl;
504 const REAL zero = 1e-14;
508 if (fNeighbours[TGeo::NSides - 1 -TGeo::NNodes].ElementIndex() != -1){
510 if (!MapToNeighSide(TGeo::NSides-1, TGeo::Dimension, xi, neighXi, notUsedHereMat)) {
512 if(logger->isDebugEnabled()) {
513 std::stringstream sout;
514 sout <<
"MapToNeighSide is singular for par " << xi <<
" and side " << TGeo::NSides-1 <<
". Aborting...";
520 Neighbour(TGeo::NSides-1, gmesh).X(neighXi, result);
530 TGeo::TShape(xi, phi, notUsedHereMat);
533 for (
int iNode = 0; iNode < TGeo::NNodes; iNode++) {
534 for (
int x = 0; x < 3; x++) {
535 result[x] += coord(x, iNode) * phi(iNode, 0);
539 if(logger->isDebugEnabled())
541 soutLogDebug <<
"Linear mapping:\n"<<std::endl;
542 for(
int i = 0; i < result.
size(); i++) soutLogDebug<<result[i]<<
"\n";
543 soutLogDebug<<std::endl;
551 for (
int sideIndex = 0; sideIndex < TGeo::NSides - TGeo::NNodes - 1; sideIndex++) {
552 int side = TGeo::NNodes + sideIndex;
553 isRegularMapping[sideIndex] = TGeo::CheckProjectionForSingularity(side,xi);
557 TPZFNMatrix<27, T> projectedPointOverSide(TGeo::NSides - TGeo::NNodes, TGeo::Dimension, 0.);
560 for (
int sideIndex = 0; sideIndex < TGeo::NSides - TGeo::NNodes - 1; sideIndex++) {
561 int side = TGeo::NNodes + sideIndex;
562 if(!isRegularMapping[sideIndex]) {
564 if(logger->isDebugEnabled()){
565 soutLogDebug <<
"mapping is not regular. skipping side... ";
573 if(logger->isDebugEnabled())
575 soutLogDebug <<
"================================" <<std::endl;
576 soutLogDebug <<
"side: "<<side<<
" is linear: ";
579 if (IsLinearMapping(side) || !gelside.
Exists()) {
580 blendFactor[sideIndex] = 0;
582 if(logger->isDebugEnabled()){
583 if( IsLinearMapping(side) ) soutLogDebug <<
"true"<<std::endl;
584 else soutLogDebug <<
"false (no gelside) "<<std::endl;
590 if(logger->isDebugEnabled()){
591 soutLogDebug <<
"false (gelside exists) "<<std::endl;
598 this->MapToSide(side, xi, sideXi, notUsedHereMat);
603 notUsedHereMat.
Resize(TGeo::Dimension,nSideNodes);
604 GetSideShapeFunction<TGeo>(side, sideXi, sidePhi, notUsedHereMat);
607 for (
int iNode = 0; iNode < nSideNodes; iNode++) {
608 const int currentNode = TGeo::SideNodeLocId(side, iNode);
610 for (
int x = 0; x < 3; x++) {
611 linearSideMappings(sideIndex, x) +=
612 coord(x, currentNode) * sidePhi(iNode, 0);
614 TGeo::ParametricDomainNodeCoord(currentNode,nodeCoord);
615 for (
int x = 0; x < TGeo::Dimension; x++) {
616 projectedPointOverSide(sideIndex,x) += nodeCoord[x] * sidePhi(iNode,0);
623 if(logger->isDebugEnabled()){
624 soutLogDebug <<
"xi projection over side:\n";
625 for (
int x = 0; x < TGeo::Dimension; x++) soutLogDebug<<projectedPointOverSide(sideIndex,x)<<
"\n";
626 soutLogDebug<<std::endl<<
"xi projection in side domain:\n";
627 for (
int x = 0; x < sideXi.size(); x++) soutLogDebug<<sideXi[x]<<
"\n";
628 soutLogDebug<<std::endl<<
"linear mapping of projected point:\n";
629 for (
int x = 0; x < 3; x++) soutLogDebug<<linearSideMappings(sideIndex, x)<<
"\n";
633 TGeo::BlendFactorForSide(side, xi, blendFactor[sideIndex], notUsedHereVec);
636 if (!MapToNeighSide(side, sidedim, xi, neighXi, notUsedHereMat)) {
638 if(logger->isDebugEnabled()) {
639 std::stringstream sout;
640 sout <<
"MapToNeighSide is singular for par " << par <<
" and side " << byside <<
" skipping the side ";
647 Neighbour(side, gmesh).X(neighXi, Xside);
648 for (
int x = 0; x < 3; x++) {
649 nonLinearSideMappings(sideIndex, x) = Xside[x];
654 TGeo::LowerDimensionSides(side, containedNodesInSide, 0);
657 TGeo::LowerDimensionSides(side, allContainedSides);
658 for (
int subSideIndex = containedNodesInSide.
NElements();
659 subSideIndex < allContainedSides.
NElements(); subSideIndex++) {
660 const int subSide = allContainedSides[subSideIndex];
662 if (logger->isDebugEnabled()) {
663 soutLogDebug <<
"\tSubside " << subSideIndex <<
" (global: " << subSide <<
") is linear: ";
664 if (IsLinearMapping(subSide)) soutLogDebug <<
"true" << std::endl;
665 else soutLogDebug <<
"false" << std::endl;
668 if(!isRegularMapping[subSide - TGeo::NNodes]) {
670 if(logger->isDebugEnabled()){
671 soutLogDebug <<
"mapping of subside is not regular. skipping side... ";
677 if (IsLinearMapping(subSide))
continue;
679 for (
int x = 0; x < TGeo::Dimension; x++) {
680 projectedPoint[x] = projectedPointOverSide(sideIndex, x);
683 T blendFactorSide = -1;
684 TGeo::BlendFactorForSide(subSide, projectedPoint, blendFactorSide,notUsedHereVec);
687 if (logger->isDebugEnabled()) {
688 soutLogDebug <<
"\tSubside influence :" << blendFactorSide << std::endl;
691 for (
int x = 0; x < 3; x++) {
692 nonLinearSideMappings(sideIndex, x) -=
694 (nonLinearSideMappings(subSide - TGeo::NNodes, x) -
695 linearSideMappings(subSide - TGeo::NNodes, x));
701 if (logger->isDebugEnabled()) {
702 soutLogDebug <<
"Non-linear mapping\n";
703 for (
int x = 0; x < 3; x++) soutLogDebug << nonLinearSideMappings(sideIndex, x) <<
"\n";
704 soutLogDebug << std::endl;
706 soutLogDebug <<
"adding to result mapping of side: " << side << std::endl;
707 soutLogDebug <<
"\t\tblend factor: " << blendFactor[sideIndex] << std::endl;
712 for (
int x = 0; x < 3; x++) {
713 result[x] += blendFactor[sideIndex] *
714 (nonLinearSideMappings(sideIndex, x) - linearSideMappings(sideIndex, x));
718 if(logger->isDebugEnabled()){
719 soutLogDebug <<
"================================" <<std::endl;
720 soutLogDebug <<
"=============result=============" <<std::endl;
721 soutLogDebug <<
"================================"<<std::endl;
722 for (
int x = 0; x < 3; x++) soutLogDebug<<result[x]<<
"\n";
723 soutLogDebug <<
"\n================================" <<std::endl;
724 soutLogDebug <<
"================================" <<std::endl;
725 soutLogDebug <<
"================================" <<std::endl;
727 soutLogDebug.str(
"");
732 template <
class TGeo>
738 int majorSide = TGeo::NSides - 1;
744 if(logger->isDebugEnabled())
746 std::stringstream sout;
747 sout <<
"input parameter par " << par;
752 TPZFNMatrix<24> blend(TGeo::NNodes,1), Dblend(TGeo::Dimension,TGeo::NNodes);
755 TPZFNMatrix<9> J1, J2, Ax, JacTemp(3,TGeo::Dimension, 0.), Jneighbourhood;
758 for(
int byside = majorSide; byside >= TGeo::NNodes; byside--)
763 TGeo::LowerDimensionSides(byside,LowNodeSides,0);
764 TGeo::LowerDimensionSides(byside,LowAllSides);
765 int dim = Neighbour(byside, gmesh).Dimension();
768 if(!MapToNeighSide(byside,sidedim,par,NeighPar, Jneighbourhood))
772 Neighbour(byside,gmesh).X(NeighPar,Xside);
773 Neighbour(byside,gmesh).Jacobian(NeighPar,J1,Ax,Det,Inv);
778 if(logger->isDebugEnabled())
780 std::stringstream sout;
781 sout <<
"byside " << byside << std::endl;
782 sout <<
"side of the neighbour " << Neighbour(byside,gmesh).Side() << std::endl;
783 Neighbour(byside,gmesh).Element()->Print(sout);
784 sout <<
"neighbour parameter(NeighPar) " << NeighPar << std::endl;
785 sout <<
"Jacobian of the map(Jneighborhood) " << Jneighbourhood << std::endl;
786 sout <<
"Xside " << Xside << std::endl;
787 sout <<
"jacobian neighbour(J1) " << J1 << std::endl;
788 Ax.
Print(
"Ax of the neighbour (Ax) ",sout);
789 sout <<
"jacobian of the neighbour multiplied by the axes(J2) " << J2 << std::endl;
797 if(logger->isDebugEnabled())
799 std::stringstream sout;
800 sout <<
"acumulated jacobian(J1) " << J1 << std::endl;
807 for(
int a = 0; a < LowNodeSides.
NElements(); a++)
812 blendTemp += blend(LowNodeSides[a],0);
813 for(
int b = 0; b < TGeo::Dimension; b++)
815 DblendTemp[b] += Dblend(b,LowNodeSides[a]);
819 for(
int a = 0; a < 3; a++)
821 for(
int b = 0; b < TGeo::Dimension; b++)
823 JacTemp(a,b) += (1 - SidesCounter[byside]) * (J1(a,b)*blendTemp + Xside[a]*DblendTemp[b]);
826 for(
int a = 0; a < LowAllSides.
NElements(); a++)
828 SidesCounter[LowAllSides[a]] += (1 - SidesCounter[byside]);
834 if(logger->isDebugEnabled())
836 std::stringstream sout;
837 JacTemp.
Print(
"Jabobian before contributing the nodes",sout);
838 sout <<
"SidesCounter " << SidesCounter << std::endl;
839 sout <<
"DBlend " << Dblend << std::endl;
840 sout <<
"NodeCoord " << coord << std::endl;
845 for(
int a = 0; a < TGeo::NNodes; a++)
847 for(
int b = 0; b < 3; b++)
849 for(
int c = 0; c < TGeo::Dimension; c++)
851 JacTemp(b,c) += (1 - SidesCounter[a]) * coord(b,a)*Dblend(c,a);
856 if(TGeo::Dimension == 1)
862 detjac = jacobian(0,0);
866 jacinv(0,0) = 1./detjac;
867 }
else if(TGeo::Dimension == 2)
875 detjac = jacobian(0,0)*jacobian(1,1) - jacobian(1,0)*jacobian(0,1);
879 jacinv(0,0) = jacobian(1,1) / detjac;
880 jacinv(1,1) = jacobian(0,0) / detjac;
881 jacinv(0,1) = -jacobian(0,1) / detjac;
882 jacinv(1,0) = -jacobian(1,0) / detjac;
891 axes(0,0) = 1.; axes(1,1) = 1.; axes(2,2) = 1.;
892 detjac = -jacobian(0,2)*jacobian(1,1)*jacobian(2,0);
893 detjac += jacobian(0,1)*jacobian(1,2)*jacobian(2,0);
894 detjac += jacobian(0,2)*jacobian(1,0)*jacobian(2,1);
895 detjac -= jacobian(0,0)*jacobian(1,2)*jacobian(2,1);
896 detjac -= jacobian(0,1)*jacobian(1,0)*jacobian(2,2);
897 detjac += jacobian(0,0)*jacobian(1,1)*jacobian(2,2);
902 if(logger->isDebugEnabled())
904 std::stringstream sout;
905 sout <<
"Singular Jacobian " << detjac;
912 jacinv(0,0) = (-jacobian(1,2)*jacobian(2,1)+jacobian(1,1)*jacobian(2,2)) / detjac;
913 jacinv(0,1) = ( jacobian(0,2)*jacobian(2,1)-jacobian(0,1)*jacobian(2,2)) / detjac;
914 jacinv(0,2) = (-jacobian(0,2)*jacobian(1,1)+jacobian(0,1)*jacobian(1,2)) / detjac;
915 jacinv(1,0) = ( jacobian(1,2)*jacobian(2,0)-jacobian(1,0)*jacobian(2,2)) / detjac;
916 jacinv(1,1) = (-jacobian(0,2)*jacobian(2,0)+jacobian(0,0)*jacobian(2,2)) / detjac;
917 jacinv(1,2) = ( jacobian(0,2)*jacobian(1,0)-jacobian(0,0)*jacobian(1,2)) / detjac;
918 jacinv(2,0) = (-jacobian(1,1)*jacobian(2,0)+jacobian(1,0)*jacobian(2,1)) / detjac;
919 jacinv(2,1) = ( jacobian(0,1)*jacobian(2,0)-jacobian(0,0)*jacobian(2,1)) / detjac;
920 jacinv(2,2) = (-jacobian(0,1)*jacobian(1,0)+jacobian(0,0)*jacobian(1,1)) / detjac;
924 template <
class TGeo>
928 out <<
"Neighbours/transformations used for mapping the sides :\n";
930 for(is=TGeo::NNodes; is<TGeo::NSides; is++)
932 out <<
"Side: " << is <<
" El/side: " << fNeighbours[is-TGeo::NNodes].ElementIndex() <<
":" <<
933 fNeighbours[is-TGeo::NNodes].Side() <<
'\n';
937 template <
class TGeo>
941 for(
int byside = TGeo::NNodes; byside < (TGeo::NSides); byside++)
948 if(!NextSide.Element())
continue;
949 while(NextSide.Element() != ElemSide.
Element())
951 if(NextSide.Exists() && !NextSide.Element()->IsLinearMapping() && !NextSide.Element()->IsGeoBlendEl())
956 SetNeighbourInfo(byside,NeighSide,NeighTransf);
959 NextSide = NextSide.Neighbour();
1065 template <
class TGeo>
1069 TGeo::InsertExampleElement(gmesh, -1, lowercorner, size);
1073 int NNodes = TGeo::NCornerNodes;
1074 for (
int i=0; i<NNodes; i++) {
1101 #define IMPLEMENTBLEND(TGEO,CREATEFUNCTION) \ 1103 template void pzgeom::TPZGeoBlend<TGEO>::X(TPZFMatrix<REAL> &coord, TPZVec<REAL> &par, TPZVec<REAL> &result) const; \ 1104 template void pzgeom::TPZGeoBlend<TGEO>::X(TPZFMatrix<REAL> &coord, TPZVec<Fad<REAL>> &par, TPZVec<Fad<REAL>> &result) const; \ 1105 template void pzgeom::TPZGeoBlend<TGEO>::GradX(TPZFMatrix<REAL> &coord, TPZVec<REAL> &xiInterior, TPZFMatrix<REAL> &gradx) const;\ 1106 template void pzgeom::TPZGeoBlend<TGEO>::GradX(TPZFMatrix<REAL> &coord, TPZVec<Fad<REAL>> &xiInterior, TPZFMatrix<Fad<REAL>> &gradx) const;\ 1108 TPZRestoreClass< TPZGeoElRefPattern<TPZGeoBlend<TGEO> >>; \ 1110 template class TPZGeoElRefLess<TPZGeoBlend<TGEO> >;\ 1111 template class TPZGeoElRefPattern<TPZGeoBlend<TGEO> >; 1122 #undef IMPLEMENTBLEND 1127 #define IMPLEMENTBLEND(TGEO,CREATEFUNCTION) \ 1129 template void pzgeom::TPZGeoBlend<TGEO>::X(TPZFMatrix<REAL> &coord, TPZVec<REAL> &par, TPZVec<REAL> &result) const; \ 1130 template void pzgeom::TPZGeoBlend<TGEO>::GradX(TPZFMatrix<REAL> &coord, TPZVec<REAL> &xiInterior, TPZFMatrix<REAL> &gradx) const;\ 1132 TPZRestoreClass< TPZGeoElRefPattern<TPZGeoBlend<TGEO> >>; \ 1134 template class TPZGeoElRefLess<TPZGeoBlend<TGEO> >;\ 1135 template class TPZGeoElRefPattern<TPZGeoBlend<TGEO> >; 1146 #undef IMPLEMENTBLEND
void Print(std::ostream &out=std::cout)
Prints the structural information of the vector object to the output stream. This method will not p...
bool IsZero(long double a)
Returns if the value a is close Zero as the allowable tolerance.
Contains declaration of TPZGeoElSide class which represents an element and its side, and TPZGeoElSideIndex class which represents an TPZGeoElSide index.
Contains definitions to LOGPZ_DEBUG, LOGPZ_INFO, LOGPZ_WARN, LOGPZ_ERROR and LOGPZ_FATAL, and the implementation of the inline InitializePZLOG(string) function using log4cxx library or not. It must to be called out of "#ifdef LOG4CXX" scope.
Contains declaration of TPZGeoElRefLess class which implements the mapping between the master element...
TPZCompEl * CreateQuadEl(TPZGeoEl *gel, TPZCompMesh &mesh, int64_t &index)
Creates computational quadrilateral element.
void GramSchmidt(TPZFMatrix< TVar > &Orthog, TPZFMatrix< TVar > &TransfToOrthog)
This method implements a Gram Schimidt method. this = Orthog.TransfToOrthog.
Implements a blending map from curved boundaries to the interior of the element. Geometry.
TPZCompEl * CreatePrismEl(TPZGeoEl *gel, TPZCompMesh &mesh, int64_t &index)
Creates computational prismal element.
std::string MElementType_Name(MElementType elType)
Returns the name of the element type.
Utility class which represents an element with its side. The Geometric approximation classes Geometry...
This class implements a simple vector storage scheme for a templated class T. Utility.
int64_t NElements() const
Access method to query the number of elements of the vector.
REAL val(STATE &number)
Returns value of the variable.
#define LOGPZ_WARN(A, B)
Define log for warnings.
TPZGeoElSide Neighbour() const
TPZGeoMesh * Mesh() const
Returns the mesh to which the element belongs.
Implements the geometry of a one dimensional linear element. Geometry.
virtual int64_t NodeIndex(int i) const =0
Returns the index of the ith node the index is the location of the node in the nodevector of the mesh...
void SideTransform3(TPZGeoElSide neighbour, TPZTransform<> &t)
Accumulates the transformations from the current element/side to the neighbour/side.
virtual TPZGeoEl * CreateGeoBlendElement(MElementType type, TPZVec< int64_t > &nodeindexes, int matid, int64_t &index)
Creates a geometric element in same fashion of CreateGeoElement but here the elements are blend...
void X(TPZFMatrix< REAL > &cornerco, TPZVec< T > &par, TPZVec< T > &result) const
Get the coordinates of the point at geometric elements from coordinates of the parametric point at th...
TPZCompEl * CreatePointEl(TPZGeoEl *gel, TPZCompMesh &mesh, int64_t &index)
Creates computational point element.
void Print(std::ostream &out=std::cout) const
Print all relevant data of the element to cout.
Contains declaration of TPZGeoElMapped class which implements a geometric element using its ancestral...
void Initialize(TPZGeoEl *refel)
Initialize the element checking connectivity on all sides.
int Zero() override
Makes Zero all the elements.
int64_t size() const
Returns the number of elements of the vector.
TPZCompEl * CreateLinearEl(TPZGeoEl *gel, TPZCompMesh &mesh, int64_t &index)
Creates computational linear element.
virtual void Resize(const int64_t newsize, const T &object)
Resizes the vector object reallocating the necessary storage, copying the existing objects to the new...
Implements a generic geometric element which is refined according to a generic refinement pattern...
Defines the behaviour of all geometric elements. GeometryTPZGeoEl is the common denominator for all g...
Contains the TPZGeoBlend class which implements a blending map from curved boundaries to the interior...
TPZGeoEl * Element(int64_t iel)
Contains the TPZGeoTetrahedra class which implements the geometry of a tetrahedral element...
#define DebugStop()
Returns a message to user put a breakpoint in.
#define LOGPZ_DEBUG(A, B)
Define log for debug info.
int MElementType_NNodes(MElementType elType)
constant which defines the type of HDiv approximation space
bool ResetBlendConnectivity(const int64_t &side, const int64_t &index)
void SetData(TPZVec< REAL > &wavedir, int numwaves)
int64_t Rows() const
Returns number of rows.
void Shape(TPZVec< REAL > &pt, TPZVec< int > orders, TPZVec< TPZTransform< REAL > > &transvec, TPZFMatrix< REAL > &phi, TPZFMatrix< REAL > &dphi)
static void InsertExampleElement(TPZGeoMesh &gmesh, int matid, TPZVec< REAL > &lowercorner, TPZVec< REAL > &size)
Method which creates a geometric boundary condition element based on the current geometric element...
Implements the geometry of a quadrilateral element. Geometry.
TPZCompEl * CreateTetraEl(TPZGeoEl *gel, TPZCompMesh &mesh, int64_t &index)
Creates computational tetrahedral element.
Contains declaration of TPZGeoElRefPattern class which implements a generic geometric element which i...
void GradX(TPZFMatrix< REAL > &cornerco, TPZVec< T > &par, TPZFMatrix< T > &gradx) const
Computes the gradient of the transformation for parametric point at master element.
#define LOGPZ_ERROR(A, B)
Define log for errors (cout)
Contains declaration of TPZCompMesh class which is a repository for computational elements...
int Redim(const int64_t newRows, const int64_t newCols) override
Redimension a matrix and ZERO your elements.
Implements the geometry of pyramid element. Geometry.
TPZCompEl * CreatePyramEl(TPZGeoEl *gel, TPZCompMesh &mesh, int64_t &index)
Creates computational pyramidal element.
Contains the TPZGeoCube class which implements the geometry of hexahedra element. ...
Contains the TPZGeoPoint class which implements the geometry of a point element or 0-D element...
Implements the geometry of a point element. Geometry.
Implements the geometry of a triangle element. Geometry.
void Jacobian(TPZFMatrix< REAL > &cornerco, TPZVec< REAL > &par, TPZFMatrix< REAL > &jacobian, TPZFMatrix< REAL > &axes, REAL &detjac, TPZFMatrix< REAL > &jacinv) const
Computes the Jacobian for parametric point at master element.
TPZGeoEl * Element() const
TPZCompEl * CreateCubeEl(TPZGeoEl *gel, TPZCompMesh &mesh, int64_t &index)
Creates computational cube element.
Implements the geometry of a tetrahedral element. Geometry.
virtual int SideIsUndefined(int side)=0
Returns 1 if the side has not been defined by buildconnectivity.
int64_t Id() const
Returns the Id of the element.
This class implements a geometric mesh for the pz environment. Geometry.
MElementType
Define the element types.
int Dimension() const
the dimension associated with the element/side
void SetNeighbourInfo(int side, TPZGeoElSide &neigh, TPZTransform<> &trans) override
virtual void Multiply(const TPZFMatrix< TVar > &A, TPZFMatrix< TVar > &res, int opt=0) const
It mutiplies itself by TPZMatrix<TVar>A putting the result in res.
Implements the geometry of a prism element. Geometry.
void Fill(const T ©, const int64_t from=0, const int64_t numelem=-1)
Will fill the elements of the vector with a copy object.
int64_t Cols() const
Returns number of cols.
virtual void Print(std::ostream &out) const
int Resize(const int64_t newRows, const int64_t wCols) override
Redimension a matrix, but maintain your elements.
Contains the TPZGeoPyramid class which implements the geometry of pyramid element.
bool IsLinearMapping(int side) const
int64_t NElements() const
Returns the number of elements of the vector.
#define IMPLEMENTBLEND(TGEO, CREATEFUNCTION)
CreateGeoElement -> TPZGeoBlend.
Contains the TPZGeoPrism class which implements the geometry of a prism element.
virtual void Print(std::ostream &out=std::cout)
Print all relevant data of the element to cout.
Groups all classes which model the geometry.
REAL ZeroTolerance()
Returns the tolerance to Zero value. Actually: .
Implements the geometry of hexahedra element. Geometry.
void Transpose(TPZMatrix< TVar > *const T) const override
It makes *T the transpose of current matrix.
TPZCompEl * CreateTriangleEl(TPZGeoEl *gel, TPZCompMesh &mesh, int64_t &index)
Creates computational triangular element.
TPZAdmChunkVector< TPZGeoEl * > & ElementVec()
Methods for handling pzlists.