java.lang.Object
org.bzdev.geom.SurfaceIntegral.Batched
- Enclosing class:
- SurfaceIntegral
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 -
Method Summary
Modifier and TypeMethodDescriptiondouble[]
Perform a series of surface integrals with the surface specified by a 3D shape.double[]
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.
-
Constructor Details
-
Batched
Constructor.- Parameters:
si
- a surface integralrest
- additional surface integrals
-
-
Method Details
-
integrate
Perform a series of surface integrals with the surface specified by a surface iterator. The values returned are in the same order as the correspondingSurfaceIntegral
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 correspondingSurfaceIntegral
object appears in the constructor.- Parameters:
si
- the surface iteratorparallel
- true if the integral should be done in parallel; false if it should be done sequentiallysize
- 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
Perform a series of surface integrals with the surface specified by a 3D shape. The values returned are in the same order as the correspondingSurfaceIntegral
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
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 correspondingSurfaceIntegral
object appears in the constructor.- Parameters:
surface
- the surface over which the integral is performedparallel
- 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
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 correspondingSurfaceIntegral
object appears in the constructor.- Parameters:
surface
- the surfacetransform
- 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 correspondingSurfaceIntegral
object appears in the constructor.- Parameters:
surface
- the surfacetransform
- the transform to apply to the surfaceparallel
- 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 correspondingSurfaceIntegral
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 surfacetransform
- the transform to apply to the surfacelevel
- 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 correspondingSurfaceIntegral
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 surfacetransform
- the transform to apply to the surfacelevel
- 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:
-