GridVolume
The GridVolume method has been superseded by GridVolume2. Use GridVolume2 instead. GridVolume has been retained for backwards compatibility.
The GridVolume method calculates the volume between two surfaces and displays the results in a report window. Returns a Boolean. Returns 'True' if the volume is calculated successfully, else returns 'False'.
Syntax
object. GridVolume( Upper, Lower, pResults, ShowReport )
Parameter |
Type |
Required/ Optional |
Default |
Description |
Upper |
Variant |
Required |
|
This specifies the upper grid surface path and file name or constant value. |
Lower |
Variant |
Required |
|
This specifies the lower grid surface path and file name or constant value. |
pResults |
Array of Doubles |
Required |
|
This is the array with the modified coordinates. It has base-0 and is indexed using the enumeration. |
ShowReport |
Boolean |
Optional |
|
This enables the show grid volume report. The report is shown only if ShowReport is true and Surfer is visible. |
zScale |
Double |
Optional |
|
This specifies the z scaling factor to be added to the volume calculation. |
Remarks
There are 11 values numbered from 0 to 10 in the srfGridVolumeParam enumeration. The GridVolume method copies an array of 11 doubles to the pResults parameter. The 11 different values correspond to the different enumerated values. For example, the first value in the array (at index 0) is the volume calculated by the trapezoidal rule (srfGVTrapVol). The second value (at index 1) is the volume calculated by Simpson’s rule (srfGVSimpVol), and so on. So you should use the enumerations as the indices into the pResults array, to get the individual value that you are interested in.
Example 1
This example demonstrates how to calculate the volume between the upper surface ("demogrid.grd") and the lower surface (a constant of 50) and display the grid volume report.
Dim Results() As Double
SurferApp.GridVolume(Upper:=SurferApp.Path+"\Samples\demogrid.grd", _
Lower:=50, pResults:=Results, ShowReport:=True)
Since the Results array is an outgoing parameter, the value of the elements within the array can be returned.
Dim Element As Integer
For Element = 0 to 9 Step 1
Debug.Print Results(Element)
Next
Or store the elements as variables to be used later.
Dim TrapezoidalRule As Double
TrapezoidalRule =
Example 2
This script displays all the methods in the Application object.
Used by: Application object