Class SurfaceIntegral.Batched

java.lang.Object
org.bzdev.geom.SurfaceIntegral.Batched
Enclosing class:
SurfaceIntegral

public static class SurfaceIntegral.Batched extends Object
Class to allow multiple surface integrals to share parts of the computation, allowing them to be completed faster. In some cases (e.g., computing moments), the vector fields being integrated are easily computed given (x, y, z) coordinates. This computation is much cheaper in terms of CPU time than the computation of tangent vectors and the x, y, and z coordinates at each point on the surface.

All of the surface integrals must have been constructed with the same parameters, and all must be of the same type (scalar or vector) if this class is used.

In one test, with using the Batched class, the running time for computing moments was over 5 seconds. Use of the Batched class reduced this to just over 1 second.

  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    double[]
    integrate(Shape3D surface)
    Perform a series of surface integrals with the surface specified by a 3D shape.
    double[]
    integrate(Shape3D surface, boolean parallel)
    Perform a series of surface integrals with the surface specified by a 3D shape, specifying if the integral should be done in parallel.
    double[]
    integrate(Shape3D surface, Transform3D transform)
    Perform a series of surface integrals with the surface specified by a 3D shape modified by a transform.
    double[]
    integrate(Shape3D surface, Transform3D transform, boolean parallel)
    Perform a series of surface integrals with the surface specified by a 3D shape modified by a transform, specifying if the integral should be done in parallel.
    double[]
    integrate(Shape3D surface, Transform3D transform, int level)
    Perform a series of surface integrals with the surface specified by a 3D shape modified by a transform, splitting each triangle or patch.
    double[]
    integrate(Shape3D surface, Transform3D transform, int level, boolean parallel)
    Perform a series of surface integrals with the surface specified by a 3D shape modified by a transform, splitting each triangle or patch, specifying if the integral should be done in parallel.
    double[]
    Perform a series of surface integrals with the surface specified by a surface iterator.
    double[]
    integrate(SurfaceIterator si, boolean parallel, int size)
    Perform a series of surface integrals with the surface specified by a surface iterator, also specifying if the integral should be done in parallel.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Batched

      public Batched(SurfaceIntegral si, SurfaceIntegral... rest)
      Constructor.
      Parameters:
      si - a surface integral
      rest - additional surface integrals
  • Method Details

    • integrate

      public double[] integrate(SurfaceIterator si) throws IllegalArgumentException
      Perform a series of surface integrals with the surface specified by a surface iterator. The values returned are in the same order as the corresponding SurfaceIntegral object appears in the constructor.
      Parameters:
      si - the surface iterator
      Returns:
      the values of the surface integrals
      Throws:
      IllegalArgumentException - the surface should have been oriented to integrate a vector field
    • integrate

      public double[] integrate(SurfaceIterator si, boolean parallel, int size) throws IllegalArgumentException
      Perform a series of surface integrals with the surface specified by a surface iterator, also specifying if the integral should be done in parallel. The values returned are in the same order as the corresponding SurfaceIntegral object appears in the constructor.
      Parameters:
      si - the surface iterator
      parallel - true if the integral should be done in parallel; false if it should be done sequentially
      size - an estimate of the number of elements (triangles and cubic patches) comprising the surface
      Returns:
      the values of the surface integrals
      Throws:
      IllegalArgumentException - the surface should have been oriented to integrate a vector field
    • integrate

      public double[] integrate(Shape3D surface) throws IllegalArgumentException
      Perform a series of surface integrals with the surface specified by a 3D shape. The values returned are in the same order as the corresponding SurfaceIntegral object appears in the constructor.
      Parameters:
      surface - the surface over which the integral is performed
      Returns:
      the values of the surface integrals
      Throws:
      IllegalArgumentException - the surface should have been oriented to integrate a vector field
    • integrate

      public double[] integrate(Shape3D surface, boolean parallel) throws IllegalArgumentException
      Perform a series of surface integrals with the surface specified by a 3D shape, specifying if the integral should be done in parallel. The values returned are in the same order as the corresponding SurfaceIntegral object appears in the constructor.
      Parameters:
      surface - the surface over which the integral is performed
      parallel - true if the integral should be done in parallel; false if it should be done sequentially
      Returns:
      the values of the surface integrals
      Throws:
      IllegalArgumentException - the surface should have been oriented to integrate a vector field
    • integrate

      public double[] integrate(Shape3D surface, Transform3D transform) throws IllegalArgumentException
      Perform a series of surface integrals with the surface specified by a 3D shape modified by a transform. The actual surface is not modified. The values returned are in the same order as the corresponding SurfaceIntegral object appears in the constructor.
      Parameters:
      surface - the surface
      transform - the transform to apply to the surface
      Returns:
      the values of the surface integrals over the transformed surface
      Throws:
      IllegalArgumentException - the surface should have been oriented to integrate a vector field
      See Also:
    • integrate

      public double[] integrate(Shape3D surface, Transform3D transform, boolean parallel) throws IllegalArgumentException
      Perform a series of surface integrals with the surface specified by a 3D shape modified by a transform, specifying if the integral should be done in parallel. The actual surface is not modified. The values returned are in the same order as the corresponding SurfaceIntegral object appears in the constructor.
      Parameters:
      surface - the surface
      transform - the transform to apply to the surface
      parallel - true if the integral should be done in parallel; false if it should be done sequentially
      Returns:
      the values of the surface integrals over the transformed surface
      Throws:
      IllegalArgumentException - the surface should have been oriented to integrate a vector field
      See Also:
    • integrate

      public double[] integrate(Shape3D surface, Transform3D transform, int level) throws IllegalArgumentException
      Perform a series of surface integrals with the surface specified by a 3D shape modified by a transform, splitting each triangle or patch. The values returned are in the same order as the corresponding SurfaceIntegral object appears in the constructor. Providing a level is useful when the transform is not an affine transform. The actual surface is not modified.
      Parameters:
      surface - the surface
      transform - the transform to apply to the surface
      level - The number of partitioning levels (each level splits each patch or triangle into quarters)
      Returns:
      the values of the surface integrals over the transformed surface
      Throws:
      IllegalArgumentException - the surface should have been oriented to integrate a vector field
      See Also:
    • integrate

      public double[] integrate(Shape3D surface, Transform3D transform, int level, boolean parallel) throws IllegalArgumentException
      Perform a series of surface integrals with the surface specified by a 3D shape modified by a transform, splitting each triangle or patch, specifying if the integral should be done in parallel. The values returned are in the same order as the corresponding SurfaceIntegral object appears in the constructor. Providing a level is useful when the transform is not an affine transform. The actual surface is not modified.
      Parameters:
      surface - the surface
      transform - the transform to apply to the surface
      level - The number of partitioning levels (each level splits each patch or triangle into quarters)
      parallel - true if the integral should be done in parallel; false if it should be done sequentially
      Returns:
      the values of the surface integrals over the transformed surface
      Throws:
      IllegalArgumentException - the surface should have been oriented to integrate a vector field
      See Also: