Beispiel #1
0
void Geometry::GetPerfPointMat (int GeomType, DenseMatrix &pm)
{
   switch (GeomType)
   {
   case Geometry::SEGMENT:
   {
      pm.SetSize (1, 2);
      pm(0,0) = 0.0;
      pm(0,1) = 1.0;
   }
   break;

   case Geometry::TRIANGLE:
   {
      pm.SetSize (2, 3);
      pm(0,0) = 0.0;  pm(1,0) = 0.0;
      pm(0,1) = 1.0;  pm(1,1) = 0.0;
      pm(0,2) = 0.5;  pm(1,2) = 0.86602540378443864676;
   }
   break;

   case Geometry::SQUARE:
   {
      pm.SetSize (2, 4);
      pm(0,0) = 0.0;  pm(1,0) = 0.0;
      pm(0,1) = 1.0;  pm(1,1) = 0.0;
      pm(0,2) = 1.0;  pm(1,2) = 1.0;
      pm(0,3) = 0.0;  pm(1,3) = 1.0;
   }
   break;

   case Geometry::TETRAHEDRON:
   {
      pm.SetSize (3, 4);
      pm(0,0) = 0.0;  pm(1,0) = 0.0;  pm(2,0) = 0.0;
      pm(0,1) = 1.0;  pm(1,1) = 0.0;  pm(2,1) = 0.0;
      pm(0,2) = 0.5;  pm(1,2) = 0.86602540378443864676;  pm(2,2) = 0.0;
      pm(0,3) = 0.5;  pm(1,3) = 0.28867513459481288225;
      pm(2,3) = 0.81649658092772603273;
   }
   break;

   case Geometry::CUBE:
   {
      pm.SetSize (3, 8);
      pm(0,0) = 0.0;  pm(1,0) = 0.0;  pm(2,0) = 0.0;
      pm(0,1) = 1.0;  pm(1,1) = 0.0;  pm(2,1) = 0.0;
      pm(0,2) = 1.0;  pm(1,2) = 1.0;  pm(2,2) = 0.0;
      pm(0,3) = 0.0;  pm(1,3) = 1.0;  pm(2,3) = 0.0;
      pm(0,4) = 0.0;  pm(1,4) = 0.0;  pm(2,4) = 1.0;
      pm(0,5) = 1.0;  pm(1,5) = 0.0;  pm(2,5) = 1.0;
      pm(0,6) = 1.0;  pm(1,6) = 1.0;  pm(2,6) = 1.0;
      pm(0,7) = 0.0;  pm(1,7) = 1.0;  pm(2,7) = 1.0;
   }
   break;

   default:
      mfem_error ("Geometry::GetPerfPointMat (...)");
   }
}
Beispiel #2
0
void IsoparametricTransformation::Transform (const IntegrationRule &ir,
                                             DenseMatrix &tr)
{
   int dof, n, dim, i, j, k;

   dim = PointMat.Height();
   dof = FElem->GetDof();
   n = ir.GetNPoints();

   shape.SetSize(dof);
   tr.SetSize(dim, n);

   for (j = 0; j < n; j++)
   {
      FElem -> CalcShape (ir.IntPoint(j), shape);
      for (i = 0; i < dim; i++)
      {
         tr(i, j) = 0.0;
         for (k = 0; k < dof; k++)
         {
            tr(i, j) += PointMat(i, k) * shape(k);
         }
      }
   }
}
Beispiel #3
0
 /// Construct a time-independent square matrix coefficient from a C-function
 MatrixFunctionCoefficient(int dim, void (*F)(const Vector &, DenseMatrix &),
                           Coefficient *q = NULL)
    : MatrixCoefficient(dim), Q(q)
 {
    Function = F;
    TDFunction = NULL;
    mat.SetSize(0);
 }
Beispiel #4
0
void IsoparametricTransformation::Transform (const DenseMatrix &matrix,
                                             DenseMatrix &result)
{
   MFEM_ASSERT(matrix.Height() == GetDimension(), "invalid input");
   result.SetSize(PointMat.Height(), matrix.Width());

   IntegrationPoint ip;
   Vector col;

   for (int j = 0; j < matrix.Width(); j++)
   {
      ip.Set(matrix.GetColumn(j), matrix.Height());

      result.GetColumnReference(j, col);
      Transform(ip, col);
   }
}
Beispiel #5
0
void IsoparametricTransformation::Transform (const DenseMatrix &matrix,
                                             DenseMatrix &result)
{
   result.SetSize(PointMat.Height(), matrix.Width());

   IntegrationPoint ip;
   Vector col;

   for (int j = 0; j < matrix.Width(); j++)
   {
      ip.x = matrix(0, j);
      if (matrix.Height() > 1)
      {
         ip.y = matrix(1, j);
         if (matrix.Height() > 2)
         {
            ip.z = matrix(2, j);
         }
      }

      result.GetColumnReference(j, col);
      Transform(ip, col);
   }
}