Skip to content

Commit a2917c8

Browse files
committed
add P1nc (Crouziex -Raviart FE?) on meshS
1 parent 501c1c7 commit a2917c8

1 file changed

Lines changed: 74 additions & 3 deletions

File tree

plugin/seq/Element_P1nc_3d.cpp

Lines changed: 74 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,75 @@
4242
/// ---------------------------------------------------------------
4343
namespace Fem2D {
4444

45-
class TypeOfFE_P1nc_3d : public TypeOfFE_Lagrange< Mesh3 > {
45+
46+
class TypeOfFE_P1nc_S : public TypeOfFE_Lagrange< MeshS > {
47+
public:
48+
typedef MeshS Mesh;
49+
typedef MeshS::Element Element;
50+
typedef GFElement< MeshS > FElement;
51+
static int dfon[];
52+
static const int d = Mesh::Rd::d;
53+
TypeOfFE_P1nc_S(): TypeOfFE_Lagrange<MeshS>(-1,2) { }
54+
55+
void FB(const What_d whatd, const MeshS &Th, const MeshS::Element &K, const MeshS::RdHat &PHat,
56+
RNMK_ &val) const;
57+
};
58+
59+
60+
61+
62+
63+
64+
void TypeOfFE_P1nc_S::FB(const What_d whatd, const MeshS &Th, const MeshS::Element &K,
65+
const MeshS::RdHat &PHat, RNMK_ &val) const {
66+
67+
assert(val.N( ) >= 3); // 4 degrees of freedom
68+
assert(val.M( ) == 1); // 1 components
69+
/*
70+
Dof Numbering 1 dof / face the dof a associated to a vertex face
71+
and the vertex a numbering in increase way.
72+
73+
we have to numbering î on ref element with
74+
75+
So we need of a permutation p to insure the compatibilit between adjacent element
76+
77+
*/
78+
79+
80+
81+
double l[3];
82+
PHat.toBary(l);
83+
val=0; ;
84+
RN_ f0(val('.', 0, op_id));
85+
if (whatd & Fop_D0) {
86+
RN_ f0(val('.',0,0));
87+
f0[0] = 1-l[0]*2;
88+
f0[1] = 1-l[1]*2;
89+
f0[2] = 1-l[2]*2;
90+
91+
92+
93+
}
94+
if (whatd & (Fop_D1 )) {
95+
const unsigned int iDx =whatd & Fop_dx , iDy =whatd & Fop_dy , iDz =whatd & Fop_dz;
96+
R3 Dl[4];
97+
K.Gradlambda(Dl);
98+
int k=0;
99+
RN_ f0x(val('.', 0, op_dx));
100+
RN_ f0y(val('.', 0, op_dy));
101+
RN_ f0z(val('.', 0, op_dz));
102+
for(int i=0; i<3;++i)
103+
{
104+
if(iDx) f0x[i] = -Dl[i].x*2.;
105+
if(iDy) f0y[i] = -Dl[i].y*2.;
106+
if(iDz) f0z[i] = -Dl[i].z*2.;
107+
}
108+
109+
}
110+
111+
}
112+
113+
class TypeOfFE_P1nc_3d : public TypeOfFE_Lagrange< Mesh3 > {
46114
public:
47115
typedef Mesh3 Mesh;
48116
typedef Mesh3::Element Element;
@@ -115,10 +183,13 @@ void TypeOfFE_P1nc_3d::FB(const What_d whatd, const Mesh &Th, const Mesh3::Eleme
115183

116184
}
117185
static TypeOfFE_P1nc_3d P1nc_3d;
186+
static TypeOfFE_P1nc_S P1nc_S;
118187
GTypeOfFE< Mesh3 > &Elm_P1nc_3d(P1nc_3d);
188+
GTypeOfFE< MeshS > &Elm_P1nc_S(P1nc_S);
189+
190+
static AddNewFE3 TFE_P1pnc_3d("P1nc3d", &Elm_P1nc_3d,"P1nc");
191+
static AddNewFES TFE_P1pnc_S("P1ncS", &Elm_P1nc_S,"P1nc");
119192

120-
static AddNewFE3 TFE_P2pnc_3d("P1nc3d", &Elm_P1nc_3d);
121-
122193
} // namespace Fem2D
123194

124195
// --- fin --

0 commit comments

Comments
 (0)