CellDerivativeFor2DCell now creates Space2D of the correct type.

Previously vtkm::Vec<> fields would construct Space2D types incorrectly
This commit is contained in:
Robert Maynard 2016-12-01 14:39:25 -05:00
parent 134f24496b
commit d1336c7f84
2 changed files with 7 additions and 5 deletions

@ -428,8 +428,8 @@ CellDerivativeFor2DCell(const FieldVecType &field,
// find the vector [ds/du, ds/dv].
// Commented because this is actually done in CellDerivativeFor2DCellFinish
// to handle vector fields.
// vtkm::Vec<BaseFieldType,2> parametricDerivative =
// ParametricDerivative(field,pcoords,CellShapeTag());
// vtkm::Vec<BaseFieldType,2> parametricDerivative =
// ParametricDerivative(field,pcoords,CellShapeTag());
// If we write out the matrices below, it should become clear that the
// Jacobian transpose times the field derivative in world space equals

@ -57,8 +57,9 @@ struct Space2D
return Vec2(vtkm::dot(vec, this->Basis0), vtkm::dot(vec, this->Basis1));
}
template<typename U>
VTKM_EXEC
Vec3 ConvertVecFromSpace(const Vec2 vec) const {
vtkm::Vec<U,3> ConvertVecFromSpace(const vtkm::Vec<U,2> vec) const {
return vec[0]*this->Basis0 + vec[1]*this->Basis1;
}
};
@ -262,11 +263,12 @@ void JacobianFor3DCell(const WorldCoordType &wCoords,
template<typename WorldCoordType,
typename ParametricCoordType,
typename SpaceType,
typename JacobianType>
VTKM_EXEC
void JacobianFor2DCell(const WorldCoordType &wCoords,
const vtkm::Vec<ParametricCoordType,3> &pcoords,
const vtkm::exec::internal::Space2D<JacobianType> &space,
const vtkm::exec::internal::Space2D<SpaceType> &space,
vtkm::Matrix<JacobianType,2,2> &jacobian,
vtkm::CellShapeTagQuad)
{
@ -274,7 +276,7 @@ void JacobianFor2DCell(const WorldCoordType &wCoords,
static_cast<JacobianType>(pcoords[1]));
vtkm::Vec<JacobianType,2> rc = vtkm::Vec<JacobianType,2>(JacobianType(1)) - pc;
vtkm::Vec<JacobianType,2> wcoords2d;
vtkm::Vec<SpaceType,2> wcoords2d;
jacobian = vtkm::Matrix<JacobianType,2,2>(JacobianType(0));
VTKM_DERIVATIVE_WEIGHTS_QUAD(pc, rc, VTKM_ACCUM_JACOBIAN_2D);
}