Mfem: How to obtain the face area and normal direction in a tetrahedra .

Created on 7 Jun 2019  路  3Comments  路  Source: mfem/mfem

Dear sir:
I want to obtain the area and normal direction of each face in a tetrahedra, which function can resolve this.
Regards

mesh question

Most helpful comment

If you just need the face normal and area, it is cheaper to use Mesh::GetFaceTransformation; also before calling the method ElementTransformation::Jacobian you should set the point at which you want to compute the normal and the area, for example:

   Vector nor;
   const int nfaces = mesh->GetNumFaces();
   for (int i = 0; i < nfaces; i++)
   {
      ElementTransformation *T = mesh->GetFaceTransformation(i);
      // Evaluate the Jacobian at the center of the face:
      T->SetIntPoint(&Geometries.GetCenter(mesh->GetFaceBaseGeometry(i)));
      CalcOrtho(T->Jacobian(), nor);
      // Use 'nor' ...
   }

All 3 comments

I haven't used grids with tetrahedra, but I guess it should be similar to hexahedra. You go to each face and use transfomations to get the normals like this.

for (int i = 0; i < mesh->GetNumFaces();; i++)
{
 T = pmesh->GetInteriorFaceTransformations(i); 
 CalcOrtho(T->Face->Jacobian(), nor);
}

The vector nor also contains information about the surface area. If you just get the magnitude of the vector, it is the surface area.

If you just need the face normal and area, it is cheaper to use Mesh::GetFaceTransformation; also before calling the method ElementTransformation::Jacobian you should set the point at which you want to compute the normal and the area, for example:

   Vector nor;
   const int nfaces = mesh->GetNumFaces();
   for (int i = 0; i < nfaces; i++)
   {
      ElementTransformation *T = mesh->GetFaceTransformation(i);
      // Evaluate the Jacobian at the center of the face:
      T->SetIntPoint(&Geometries.GetCenter(mesh->GetFaceBaseGeometry(i)));
      CalcOrtho(T->Jacobian(), nor);
      // Use 'nor' ...
   }

Hi @v-dobrev ,

How to get the direction of every normal vector?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sshiraiwa picture sshiraiwa  路  4Comments

anjirom picture anjirom  路  3Comments

kolotinsky1998 picture kolotinsky1998  路  4Comments

thorvath12 picture thorvath12  路  3Comments

brightzhang91 picture brightzhang91  路  4Comments