7 Fields

7.4 Fields for VectorNd, MatrixNd and Vector3d

The vector fields described above can be implemented for most fixed-size vectors and matrices defined in the package maspack.matrix (e.g., Vector2d, Vector3d, Matrix3d). However, if vectors or matrices with different size are needed, it is also possible to create vector fields using VectorNd and MatrixNd, provided that the sizing remain constant within any given field. This is achieved using special wrapper classes that contain the sizing information, which is supplied in the constructors. For convenience, wrapper classes are also provided for vector fields that use Vector3d, since that vector size is quite common.

For vector FEM and mesh fields, the complete set of wrapper classes is listed below:

Class base class vector type T
Vector FEM fields:
Vector3dNodalField VectorNodalField<T> Vector3d
VectorNdNodalField VectorNodalField<T> VectorNd
MatrixNdNodalField VectorNodalField<T> MatrixNd
Vector3dElementField VectorElementField<T> Vector3d
VectorNdElementField VectorElementField<T> VectorNd
MatrixNdElementField VectorElementField<T> MatrixNd
Vector3dSubElemField VectorSubElemField<T> Vector3d
VectorNdSubElemField VectorSubElemField<T> VectorNd
MatrixNdSubElemField VectorSubElemField<T> MatrixNd
Vector mesh fields:
Vector3dVertexField VectorVertexField<T> Vector3d
VectorNdVertexField VectorVertexField<T> VectorNd
MatrixNdVertexField VectorVertexField<T> MatrixNd
Vector3dFaceField VectorFaceField<T> Vector3d
VectorNdFaceField VectorFaceField<T> VectorNd
MatrixNdFaceField VectorFaceField<T> MatrixNd

These all behave identically to their base classes, except that their constructors omit the type argument (since this is built into the class definition) and, for VectorNd and MatrixNd, supply information about the vector or matrix sizes. For example, constructors for the FEM nodal fields include

  Vector3dNodalField (FemModel3d fem)
  Vector3dNodalField (FemModel3d fem, Vector3d defaultValue)
  Vector3dNodalField (String name, FemModel3d fem, Vector3d defaultValue)
  VectorNdNodalField (int vecSize, FemModel3d fem)
  VectorNdNodalField (int vecSize, FemModel3d fem, VectorNd defaultValue)
  VectorNdNodalField (
    int vecSize, String name, FemModel3d fem, VectorNd defaultValue)
  MatrixNdNodalField (int rowSize, int colSize, FemModel3d fem)
  MatrixNdNodalField (
    int rowSize, int colSize, FemModel3d fem, MatrixNd defaultValue)
  MatrixNdNodalField (
    int rowSize, int colSize, String name, FemModel3d fem, MatrixNd defaultValue)

where vecSize, rowSize and colSize give the sizes of the VectorNd or MatrixNd objects within the field. Constructors for other field types are equivalent and are described in their API documentation.

For grid fields, one can use either VectorNdGrid or MatrixNdGrid, both defined in maspack.geometry, as the primary grid used to construct the field. Constructors for these include

  VectorNdGrid (int VecSize, Vector3d widths, Vector3i res)
  MatrixNdGrid (
    int rowSize int colSize, Vector3d widths, Vector3i res, RigidTransform3d TCL)