Exemplo n.º 1
0
void Line2D::compute_normal(const NodesT& nodes , CoordsT& result)
{
  /// @bug this normal is a P1 approximation
  result[XX] = 0.5*( nodes(1, YY) - nodes(0, YY));
  result[YY] = 0.5*(-nodes(1, XX) + nodes(0, XX));
  result.normalize();
}
Exemplo n.º 2
0
void Line1D::compute_centroid(const NodesT& nodes , CoordsT& centroid)
{
  cf3_assert(nodes.rows()==2);
  cf3_assert(nodes.cols()==1);
  cf3_assert(centroid.size()==1);
  centroid[0] = 0.5*(nodes(0,XX)+nodes(1,XX));
}
Exemplo n.º 3
0
void Quad3D::compute_normal(const NodesT& nodes , CoordsT& normal)
{
  JacobianT jac = jacobian(MappedCoordsT::Zero(), nodes);

  normal[XX] = jac(KSI,YY)*jac(ETA,ZZ) - jac(KSI,ZZ)*jac(ETA,YY);
  normal[YY] = jac(KSI,ZZ)*jac(ETA,XX) - jac(KSI,XX)*jac(ETA,ZZ);
  normal[ZZ] = jac(KSI,XX)*jac(ETA,YY) - jac(KSI,YY)*jac(ETA,XX);

  normal.normalize();
}
Exemplo n.º 4
0
void Triag3D::compute_normal(const NodesT& nodes, CoordsT& result)
{
  /// @todo this could be simpler for this application
  /// Jacobian could be avoided
  JacobianT jac = jacobian(MappedCoordsT::Zero(),nodes);

  result[XX] = jac(KSI,YY)*jac(ETA,ZZ) - jac(KSI,ZZ)*jac(ETA,YY);
  result[YY] = jac(KSI,ZZ)*jac(ETA,XX) - jac(KSI,XX)*jac(ETA,ZZ);
  result[ZZ] = jac(KSI,XX)*jac(ETA,YY) - jac(KSI,YY)*jac(ETA,XX);

  // turn into unit vector
  result.normalize();
}
Exemplo n.º 5
0
void Triag2DLagrangeP2::mapped_coordinates(const CoordsT& coord, const NodeMatrixT& nodes, MappedCoordsT& map_coord)
{
  throw Common::NotImplemented( FromHere(), "" );

  cf_assert(coord.size() == 2);
  cf_assert(map_coord.size() == 2);
  cf_assert(nodes.size() == 6);

  const Real invDet = 1. / jacobian_determinant(nodes);

  map_coord[KSI] = invDet * ((nodes(2, YY) - nodes(0, YY))*coord[XX] + (nodes(0, XX) - nodes(2, XX))*coord[YY] - nodes(0, XX)*nodes(2, YY) + nodes(2, XX)*nodes(0, YY));
  map_coord[ETA] = invDet * ((nodes(0, YY) - nodes(1, YY))*coord[XX] + (nodes(1, XX) - nodes(0, XX))*coord[YY] + nodes(0, XX)*nodes(1, YY) - nodes(1, XX)*nodes(0, YY));

}
Exemplo n.º 6
0
Real Quad3DLagrangeP1::area(const NodeMatrixT& nodes)
{
  CoordsT n;
  normal(MappedCoordsT::Zero(), nodes, n);
  return 4.*n.norm();
}