48 return {lcoords[0], lcoords[1], 1. - lcoords[0] - lcoords[1]};
57 1. - lcoords.
at(1) - lcoords.
at(2)
61std::pair<double, FloatMatrixF<2,3>>
70 double detJ = x1 * ( y2 - y3 ) + x2 * ( y3 - y1 ) + x3 * ( y1 - y2 );
78 return {detJ, ans * (1./detJ)};
85 double x1, x2, x3, y1, y2, y3, detJ;
95 detJ = x1 * ( y2 - y3 ) + x2 * ( -y1 + y3 ) + x3 * ( y1 - y2 );
98 answer.
at(1, 1) = ( y2 - y3 ) / detJ;
99 answer.
at(1, 2) = ( x3 - x2 ) / detJ;
101 answer.
at(2, 1) = ( y3 - y1 ) / detJ;
102 answer.
at(2, 2) = ( x1 - x3 ) / detJ;
104 answer.
at(3, 1) = ( y1 - y2 ) / detJ;
105 answer.
at(3, 2) = ( x2 - x1 ) / detJ;
113 double l1 = lcoords.
at(1);
114 double l2 = lcoords.
at(2);
115 double l3 = 1.0 - l1 - l2;
127#define POINT_TOL 1.e-3
140 double detJ = x1 * ( y2 - y3 ) + x2 * ( -y1 + y3 ) + x3 * ( y1 - y2 );
143 answer.
at(1) = ( ( x2 * y3 - x3 * y2 ) + ( y2 - y3 ) * coords.
at(
xind) + ( x3 - x2 ) * coords.
at(
yind) ) / detJ;
144 answer.
at(2) = ( ( x3 * y1 - x1 * y3 ) + ( y3 - y1 ) * coords.
at(
xind) + ( x1 - x3 ) * coords.
at(
yind) ) / detJ;
148 for (
int i = 1; i <= 2; i++ ) {
158 if( ( answer.
at(1) + answer.
at(2)) > 1.0 ) {
159 const double temp = 0.5*( answer.
at(1) + answer.
at(2) - 1.);
160 answer.
at(1) -= temp;
161 answer.
at(2) -= temp;
165 answer.
at(3) = 1. - answer.
at(1) - answer.
at(2);
182 return ( x1 * ( y2 - y3 ) + x2 * ( -y1 + y3 ) + x3 * ( y1 - y2 ) );
187 const double point_tol = 1.0e-3;
189 for (
int i = 1; i <= 2; i++ ) {
190 if ( lcoords.
at(i) < - point_tol ) {
192 }
else if ( lcoords.
at(i) > ( 1. + point_tol ) ) {
197 if ( 1. - lcoords.
at(1) - lcoords.
at(2) < - point_tol ) {
199 }
else if ( 1. - lcoords.
at(1) - lcoords.
at(2) > ( 1. + point_tol ) ) {
209 double ksi = lcoords.
at(1);
210 answer =
Vec2( ( 1. - ksi ) * 0.5, ( 1. + ksi ) * 0.5 );
220 answer =
Vec2( -1.0 / l, 1.0 / l );
239 this->
edgeEvalN(n, iedge, lcoords, cellgeo);
250FEI2dTrLin :: computeLocalEdgeMapping(
int iedge)
const
254 }
else if ( iedge == 2 ) {
256 }
else if ( iedge == 3 ) {
259 throw std::range_error(
"invalid edge number");
267 int nodeA = edgeNodes.
at(1);
268 int nodeB = edgeNodes.
at(2);
272 return sqrt(dx * dx + dy * dy);
280 double y1 = p1.at(
yind);
283 double y2 = p2.at(
yind);
286 double y3 = p3.at(
yind);
288 return fabs( 0.5 * ( x1 * ( y2 - y3 ) + x2 * ( -y1 + y3 ) + x3 * ( y1 - y2 ) ) );
297 double x1 = node1.
at(
xind);
298 double y1 = node1.at(
yind);
301 double x2 = node2.
at(
xind);
302 double y2 = node2.at(
yind);
304 return -( x2 * y1 - x1 * y2 );
307std::unique_ptr<IntegrationRule>
310 auto iRule = std::make_unique<GaussIntegrationRule>(1,
nullptr);
311 int points = iRule->getRequiredNumberOfIntegrationPoints(
_Triangle,
order + 0);
312 iRule->SetUpPointsOnTriangle(points, _Unknown);
313 return std::move(iRule);
322 this->
evalN(
N, lcoords, cellgeo);
325 for (
int i = 1; i <= 3; i++ ) {
339 this->
edgeEvalN(n, iedge, lcoords, cellgeo);
double edgeGiveTransformationJacobian(int iedge, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override
double boundaryEdgeGiveTransformationJacobian(int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override
double boundaryGiveTransformationJacobian(int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override
static FloatArrayF< 3 > evalN(const FloatArrayF< 2 > &lcoords)
IntArray computeLocalEdgeMapping(int iedge) const override
double edgeComputeLength(const IntArray &edgeNodes, const FEICellGeometry &cellgeo) const
bool inside(const FloatArray &lcoords) const override
void edgeEvalN(FloatArray &answer, int iedge, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override
double giveTransformationJacobian(const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override
virtual const FloatArray giveVertexCoordinates(int i) const =0
virtual double edgeGiveTransformationJacobian(int iedge, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const
void zero()
Zeroes all coefficients of receiver.
double normalize_giveNorm()
void resize(Index rows, Index cols)
double at(std::size_t i, std::size_t j) const
static FloatArray Vec2(const double &a, const double &b)
static FloatArray Vec3(const double &a, const double &b, const double &c)