47 double x1, x2, x3, x4, y1, y2, y3, y4;
48 double x85, x56, x67, x78, y85, y56, y67, y78;
69 x85 = node8.at(
xind) - node5.at(
xind);
70 x56 = node5.at(
xind) - node6.at(
xind);
71 x67 = node6.at(
xind) - node7.at(
xind);
72 x78 = node7.at(
xind) - node8.at(
xind);
74 y85 = node8.at(
yind) - node5.at(
yind);
75 y56 = node5.at(
yind) - node6.at(
yind);
76 y67 = node6.at(
yind) - node7.at(
yind);
77 y78 = node7.at(
yind) - node8.at(
yind);
79 double p1 = ( x2 - x4 ) * ( y1 - y3 ) - ( x1 - x3 ) * ( y2 - y4 );
80 double p2 = y1 * x85 + y2 * x56 + y3 * x67 + y4 * x78 - x1 * y85 - x2 * y56 - x3 * y67 - x4 * y78;
82 return fabs(p1 + p2 * 4.0) / 6.;
89 double ksi = lcoords[0];
90 double eta = lcoords[1];
92 ( 1. + ksi ) * ( 1. + eta ) * 0.25 * ( ksi + eta - 1. ),
93 ( 1. - ksi ) * ( 1. + eta ) * 0.25 * ( -ksi + eta - 1. ),
94 ( 1. - ksi ) * ( 1. - eta ) * 0.25 * ( -ksi - eta - 1. ),
95 ( 1. + ksi ) * ( 1. - eta ) * 0.25 * ( ksi - eta - 1. ),
96 0.5 * ( 1. - ksi * ksi ) * ( 1. + eta ),
97 0.5 * ( 1. - ksi ) * ( 1. - eta * eta ),
98 0.5 * ( 1. - ksi * ksi ) * ( 1. - eta ),
99 0.5 * ( 1. + ksi ) * ( 1. - eta * eta )
107 double ksi = lcoords.
at(1);
108 double eta = lcoords.
at(2);
111 ( 1. + ksi ) * ( 1. + eta ) * 0.25 * ( ksi + eta - 1. ),
112 ( 1. - ksi ) * ( 1. + eta ) * 0.25 * ( -ksi + eta - 1. ),
113 ( 1. - ksi ) * ( 1. - eta ) * 0.25 * ( -ksi - eta - 1. ),
114 ( 1. + ksi ) * ( 1. - eta ) * 0.25 * ( ksi - eta - 1. ),
115 0.5 * ( 1. - ksi * ksi ) * ( 1. + eta ),
116 0.5 * ( 1. - ksi ) * ( 1. - eta * eta ),
117 0.5 * ( 1. - ksi * ksi ) * ( 1. - eta ),
118 0.5 * ( 1. + ksi ) * ( 1. - eta * eta )
126 double ksi = lcoords.
at(1);
127 double eta = lcoords.
at(2);
130 0.25 * ( 1. + eta ) * ( 2.0 * ksi + eta ),
131 0.25 * ( 1. + ksi ) * ( 2.0 * eta + ksi ),
132 -0.25 * ( 1. + eta ) * ( -2.0 * ksi + eta ),
133 0.25 * ( 1. - ksi ) * ( 2.0 * eta - ksi ),
134 -0.25 * ( 1. - eta ) * ( -2.0 * ksi - eta ),
135 -0.25 * ( 1. - ksi ) * ( -2.0 * eta - ksi ),
136 0.25 * ( 1. - eta ) * ( 2.0 * ksi - eta ),
137 -0.25 * ( 1. + ksi ) * ( -2.0 * eta + ksi ),
139 0.5 * ( 1. - ksi * ksi ),
140 -0.5 * ( 1. - eta * eta ),
143 -0.5 * ( 1. - ksi * ksi ),
144 0.5 * ( 1. - eta * eta ),
153 answer = dNdxi(lcoords);
155 double ksi = lcoords.
at(1);
156 double eta = lcoords.
at(2);
160 answer.
at(1, 1) = 0.25 * ( 1. + eta ) * ( 2.0 * ksi + eta );
161 answer.
at(2, 1) = -0.25 * ( 1. + eta ) * ( -2.0 * ksi + eta );
162 answer.
at(3, 1) = -0.25 * ( 1. - eta ) * ( -2.0 * ksi - eta );
163 answer.
at(4, 1) = 0.25 * ( 1. - eta ) * ( 2.0 * ksi - eta );
164 answer.
at(5, 1) = -ksi * ( 1. + eta );
165 answer.
at(6, 1) = -0.5 * ( 1. - eta * eta );
166 answer.
at(7, 1) = -ksi * ( 1. - eta );
167 answer.
at(8, 1) = 0.5 * ( 1. - eta * eta );
169 answer.
at(1, 2) = 0.25 * ( 1. + ksi ) * ( 2.0 * eta + ksi );
170 answer.
at(2, 2) = 0.25 * ( 1. - ksi ) * ( 2.0 * eta - ksi );
171 answer.
at(3, 2) = -0.25 * ( 1. - ksi ) * ( -2.0 * eta - ksi );
172 answer.
at(4, 2) = -0.25 * ( 1. + ksi ) * ( -2.0 * eta + ksi );
173 answer.
at(5, 2) = 0.5 * ( 1. - ksi * ksi );
174 answer.
at(6, 2) = -eta * ( 1. - ksi );
175 answer.
at(7, 2) = -0.5 * ( 1. - ksi * ksi );
176 answer.
at(8, 2) = -eta * ( 1. + ksi );
181std::pair<double, FloatMatrixF<2,8>>
186 for ( std::size_t i = 1; i <= dn.cols(); i++ ) {
189 double y = c.at(
yind);
192 jacT(0, 0) += dn.
at(1, i) * x;
193 jacT(0, 1) += dn.
at(1, i) * y;
194 jacT(1, 0) += dn.
at(2, i) * x;
195 jacT(1, 1) += dn.
at(2, i) * y;
206 auto tmp =
evaldNdx(lcoords, cellgeo);
220 jacobianMatrix.at(1, 1) += dn.
at(i, 1) * x;
221 jacobianMatrix.at(1, 2) += dn.
at(i, 1) * y;
222 jacobianMatrix.at(2, 1) += dn.
at(i, 2) * x;
223 jacobianMatrix.at(2, 2) += dn.
at(i, 2) * y;
226 inv.beInverseOf(jacobianMatrix);
229 return jacobianMatrix.giveDeterminant();
238 this->
evalN(n, lcoords, cellgeo);
242 for (
int i = 1; i <= n.
giveSize(); i++ ) {
257 const double point_tol = 1.0e-3;
259 for (
int i = 1; i <= 2; i++ ) {
260 if ( lcoords.
at(i) < ( -1. - point_tol ) ) {
262 }
else if ( lcoords.
at(i) > ( 1. + point_tol ) ) {
276 double ksi = lcoords.
at(1);
277 double n3 = 1. - ksi * ksi;
279 answer =
Vec3( ( 1. - ksi - n3 ) * 0.5, ( 1. + ksi - n3 ) * 0.5, n3 );
286 double ksi = lcoords.
at(1);
287 answer =
Vec3( ksi - 0.5, ksi + 0.5, ksi * 2.0 );
291FEI2dQuadQuad :: edgeLocal2global(
FloatArray &answer,
int iedge,
296 this->
edgeEvalN(n, iedge, lcoords, cellgeo);
309FEI2dQuadQuad :: computeLocalEdgeMapping(
int iedge)
const
313 }
else if ( iedge == 2 ) {
315 }
else if ( iedge == 3 ) {
317 }
else if ( iedge == 4 ) {
320 throw std::range_error(
"invalid edge number");
328 double xi = lcoords(0);
329 double dN1dxi = -0.5 + xi;
330 double dN2dxi = 0.5 + xi;
331 double dN3dxi = -2.0 * xi;
353 double x1 = node1.
at(
xind);
354 double y1 = node1.
at(
yind);
357 double x2 = node2.
at(
xind);
358 double y2 = node2.
at(
yind);
361 double x3 = node3.
at(
xind);
362 double y3 = node3.
at(
yind);
364 return -( x1 * y2 - x2 * y1 + 4 * ( x3 * ( y1 - y2 ) + y3 * ( x2 - x1 ) ) ) / 3.0;
368std::unique_ptr<IntegrationRule>
371 auto iRule = std::make_unique<GaussIntegrationRule>(1,
nullptr);
372 int points = iRule->getRequiredNumberOfIntegrationPoints(
_Square,
order + 4);
373 iRule->SetUpPointsOnSquare(points, _Unknown);
374 return std::move(iRule);
385 this->
evalN(
N, lcoords, cellgeo);
388 for (
int i = 1; i <= 8; i++ ) {
402 this->
edgeEvalN(n, iedge, lcoords, cellgeo);
double edgeGiveTransformationJacobian(int iedge, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override
double boundaryGiveTransformationJacobian(int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override
double boundaryEdgeGiveTransformationJacobian(int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override
static FloatMatrixF< 2, 8 > evaldNdxi(const FloatArrayF< 2 > &lcoords)
std::pair< double, FloatMatrixF< 2, 8 > > evaldNdx(const FloatArrayF< 2 > &lcoords, const FEICellGeometry &cellgeo) const
IntArray computeLocalEdgeMapping(int iedge) const override
bool inside(const FloatArray &lcoords) const override
void edgeEvalN(FloatArray &answer, int iedge, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override
static FloatArrayF< 8 > evalN(const FloatArrayF< 2 > &lcoords)
virtual const FloatArray giveVertexCoordinates(int i) const =0
virtual const FEInterpolation * getGeometryInterpolation() const
virtual double edgeGiveTransformationJacobian(int iedge, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const
virtual double giveTransformationJacobian(const FloatArray &lcoords, const FEICellGeometry &cellgeo) const
virtual void giveJacobianMatrixAt(FloatMatrix &jacobianMatrix, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const
double & at(std::size_t i)
Index giveSize() const
Returns the size of receiver.
void zero()
Zeroes all coefficients of receiver.
double normalize_giveNorm()
double at(std::size_t i, std::size_t j) const
void resize(Index rows, Index cols)
void beProductOf(const FloatMatrix &a, const FloatMatrix &b)
int giveNumberOfRows() const
Returns number of rows of receiver.
double at(std::size_t i, std::size_t j) const
double det(const FloatMatrixF< 2, 2 > &mat)
Computes the determinant.
static FloatArray Vec8(const double &a, const double &b, const double &c, const double &d, const double &e, const double &f, const double &g, const double &h)
double dot(const FloatArray &x, const FloatArray &y)
FloatMatrixF< N, N > inv(const FloatMatrixF< N, N > &mat, double zeropiv=1e-24)
Computes the inverse.
double distance(const FloatArray &x, const FloatArray &y)
static FloatArray Vec3(const double &a, const double &b, const double &c)