Ejemplo n.º 1
0
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void QuadGeom::findDerivatives(DoubleArrayType::Pointer field, DoubleArrayType::Pointer derivatives)
{
  int64_t numQuads = getNumberOfQuads();
  int cDims = field->getNumberOfComponents();
  double* fieldPtr = field->getPointer(0);
  double* derivsPtr = derivatives->getPointer(0);
  double values[4];
  double derivs[3];
  int64_t verts[4];
  for (int64_t i = 0; i < numQuads; i++)
  {
    getVertsAtQuad(i, verts);
    for (int j = 0; j < cDims; j++)
    {
      for (size_t k = 0; k < 4; k++)
      {
        values[k] = fieldPtr[cDims * verts[k] + j];
      }
      DerivativeHelpers::QuadDeriv()(this, i, values, derivs);
      derivsPtr[i * 3 * cDims + j * 3] = derivs[0];
      derivsPtr[i * 3 * cDims + j * 3 + 1] = derivs[1];
      derivsPtr[i * 3 * cDims + j * 3 + 2] = derivs[2];
    }
  }
}
Ejemplo n.º 2
0
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void VertexGeom::findDerivatives(DoubleArrayType::Pointer field, DoubleArrayType::Pointer derivatives)
{
  int64_t numVerts = getNumberOfVertices();
  int cDims = field->getNumberOfComponents();
  double* derivsPtr = derivatives->getPointer(0);
  for (int64_t i = 0; i < numVerts; i++)
  {
    for (int j = 0; j < cDims; j++)
    {
      derivsPtr[i * 3 * cDims + j * 3] = 0.0;
      derivsPtr[i * 3 * cDims + j * 3 + 1] = 0.0;
      derivsPtr[i * 3 * cDims + j * 3 + 2] = 0.0;
    }
  }
}