Skip to content

Commit

Permalink
Changes in the approximation space including the EHDivOptimized family
Browse files Browse the repository at this point in the history
  • Loading branch information
giavancini committed Jun 4, 2024
1 parent 7a06ca3 commit 0c3c958
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 7 deletions.
25 changes: 25 additions & 0 deletions Mesh/TPZCompElHDivDuplConnects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include "TPZCompElHDivDuplConnectsBound.h"
#include "TPZMaterial.h"
#include "TPZShapeHDiv.h"
#include "TPZShapeHDivOptimized.h"
#include "TPZShapeHDivConstant.h"
#include "pzlog.h"
#include "pzconnect.h"
Expand Down Expand Up @@ -108,6 +109,26 @@ int TPZCompElHDivDuplConnects<TSHAPE>::NConnectShapeF(int connect, int order)con
return nshape;
}
break;
case HDivFamily::EHDivOptimized:
{
int conCorrect = connect/2;
int res = connect % 2;
int nshape;
if (!fDuplicationActive){
return TPZShapeHDivOptimized<TSHAPE>::ComputeNConnectShapeF(connect,order);
} else {
nshape = TPZShapeHDivOptimized<TSHAPE>::ComputeNConnectShapeF(conCorrect,order);
}
if (res == 1){
nshape -= 1;
} else {
if (connect != 2*TSHAPE::NFacets){
nshape = 1;
}
}
return nshape;
}
break;

default:
return -1;
Expand Down Expand Up @@ -145,6 +166,10 @@ void TPZCompElHDivDuplConnects<TSHAPE>::InitMaterialData(TPZMaterialData &data)
TPZShapeHDivConstant<TSHAPE>::Initialize(ids, orders, sideorient, data);
nvec_shape = this->NShapeF();
break;
case HDivFamily::EHDivOptimized:
TPZShapeHDivOptimized<TSHAPE>::Initialize(ids, orders, sideorient, data);
nvec_shape = TPZShapeHDivOptimized<TSHAPE>::NShapeF(shapedata);
break;

default:
break;
Expand Down
21 changes: 15 additions & 6 deletions Mesh/pzelchdiv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "tpzline.h"
#include "tpztriangle.h"
#include "TPZShapeHDiv.h"
#include "TPZShapeHDivOptimized.h"
#include "TPZShapeH1.h"
#include "TPZShapeHDivConstant.h"
#include "TPZShapeHCurlNoGrads.h"
Expand Down Expand Up @@ -255,7 +256,9 @@ int TPZCompElHDiv<TSHAPE>::NConnectShapeF(int connect, int order)const
case HDivFamily::EHDivConstant:
return TPZShapeHDivConstant<TSHAPE>::ComputeNConnectShapeF(connect,order);
break;

case HDivFamily::EHDivOptimized:
return TPZShapeHDivOptimized<TSHAPE>::ComputeNConnectShapeF(connect,order);
break;
default:
return -1;
break;
Expand Down Expand Up @@ -879,7 +882,10 @@ void TPZCompElHDiv<TSHAPE>::InitMaterialData(TPZMaterialData &data)
TPZShapeHDivConstant<TSHAPE>::Initialize(ids, orders, sideorient, data);
nvec_shape = this->NShapeF();
break;

case HDivFamily::EHDivOptimized:
TPZShapeHDivOptimized<TSHAPE>::Initialize(ids, orders, sideorient, data);
nvec_shape = TPZShapeHDivOptimized<TSHAPE>::NShapeF(shapedata);
break;
default:
break;
}
Expand Down Expand Up @@ -940,13 +946,14 @@ void TPZCompElHDiv<TSHAPE>::ComputeShape(TPZVec<REAL> &qsi, TPZMaterialData &dat
case HDivFamily::EHDivStandard:
TPZShapeHDiv<TSHAPE>::Shape(qsi, shapedata, phiMaster, data.divphi);
break;

case HDivFamily::EHDivConstant:
phiMaster.Resize(TSHAPE::Dimension,nshape);
data.divphi.Resize(nshape,1);
TPZShapeHDivConstant<TSHAPE>::Shape(qsi, shapedata, phiMaster, data.divphi);
break;

case HDivFamily::EHDivOptimized:
TPZShapeHDivOptimized<TSHAPE>::Shape(qsi, shapedata, phiMaster, data.divphi);
break;
default:
DebugStop();
break;
Expand Down Expand Up @@ -992,14 +999,16 @@ void TPZCompElHDiv<TSHAPE>::ComputeShape(TPZVec<REAL> &qsi, TPZMaterialData &dat
switch (fhdivfam)
{
case HDivFamily::EHDivStandard:
TPZShapeHDiv<TSHAPE>::Shape(qsifad, shapedata, phiMasterFad, divphiFad);
TPZShapeHDiv<TSHAPE>::Shape(qsifad, shapedata, phiMasterFad, divphiFad);
break;

case HDivFamily::EHDivConstant:
phiMasterFad.Resize(TSHAPE::Dimension,nshape);
divphiFad.Resize(nshape,1);
TPZShapeHDivConstant<TSHAPE>::Shape(qsifad, shapedata, phiMasterFad, divphiFad);
break;
case HDivFamily::EHDivOptimized:
TPZShapeHDivOptimized<TSHAPE>::Shape(qsifad, shapedata, phiMasterFad, divphiFad);
break;

default:
DebugStop();
Expand Down
4 changes: 3 additions & 1 deletion Mesh/pzelchdivbound2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ TPZIntelGen<TSHAPE>(mesh,gel,1), fSideOrient(1), fhdivfam(hdivfam){
this->fIntRule.SetOrder(order);


if (fhdivfam == HDivFamily::EHDivConstant) {
if (fhdivfam == HDivFamily::EHDivConstant || fhdivfam == HDivFamily::EHDivOptimized) {
// For HDiv constant, polynomial order was compatibilized in connectorders,
// see TPZShapeHDivConstantBound<TSHAPE>::Initialize. So now we need to update
// the number of shape functions and also the integration rule
Expand Down Expand Up @@ -407,6 +407,7 @@ void TPZCompElHDivBound2<TSHAPE>::InitMaterialData(TPZMaterialData &data)
TPZShapeHDivBound<TSHAPE>::Initialize(id, connectorder, sideorient, data);
break;
case HDivFamily::EHDivConstant:
case HDivFamily::EHDivOptimized:
TPZShapeHDivConstantBound<TSHAPE>::Initialize(id, connectorder, sideorient, data);
break;

Expand Down Expand Up @@ -580,6 +581,7 @@ void TPZCompElHDivBound2<TSHAPE>::ComputeShape(TPZVec<REAL> &intpoint, TPZMateri
}
break;
case HDivFamily::EHDivConstant:
case HDivFamily::EHDivOptimized:
{
data.phi.Resize(this->NShapeF(), 1);
TPZShapeHDivConstantBound<TSHAPE>::Shape(intpoint, shapedata, data.phi);
Expand Down

0 comments on commit 0c3c958

Please sign in to comment.