Initial Lines of the Macro

Open the file createLineProbes.java in an appropriate text editor. The first few lines of the macro specify the package to which the macro class belongs and the imported libraries that Simcenter STAR-CCM+ use to compile the macro.

// STAR-CCM+ macro: createLineProbes.java
package macro;
 
import java.util.*;
 
import star.common.*;
import star.base.neo.*;
import star.vis.*;

After this initial section, see the class specifier.

public class createLineProbes extends StarMacro {

A macro recorded by Simcenter STAR-CCM+ is a fully specified Java class derived from the StarMacro base class. The parts of this class specifier are briefly explained as follows:

  • public informs the Java compiler that there are no access restrictions on this class.
  • class is the keyword used to define a class.
  • createLineProbes is the name of the class. This name must match the name of the file containing the class.
  • extends indicates that the class is derived from another class (and inherits all the public and protected methods of that class).
  • StarMacro is the name of the base class from which this one is derived.
  • { is the opening brace of the class. It is matched by a closing brace at the end of the class.

The createLineProbes class contains one method called execute. All macros must contain this method, and this is the method that Simcenter STAR-CCM+ calls to run the macro:

public void execute() {

The parts of the method signature are as follows:

  • public is the access specifier and indicates that there are no restrictions on calling this method.
  • void indicates that this method does not return any value.
  • execute() is the name and argument list of the method. There are no arguments for this method.
  • { is the opening brace of the method, and must be matched by a closing brace at the end.

The body of the execute method simply calls the private method, execute0. Consideration of execute0 now follows.