|
Purpose:
|
Provides methods for the unary minus, or negation, mathematical function.
|
|
|
Derivation:
|
negate_law : unary_law : law : ACIS_OBJECT : -
|
|
|
SAT Identifier:
|
"-"
|
|
|
Filename:
|
law/lawutil/main_law.hxx
|
|
|
Constructor:
|
public: negate_law::negate_law
(
|
|
|
law* in_sublaw
|
// pointer to sublaw
|
|
|
);
|
|
|
C++ constructor, creating a
negate_law. This has a pointer to a sublaw passed in as one of its arguments.
|
|
|
|
|
Methods:
|
public: char const* negate_law::class_name
();
|
|
|
This method returns a string that contains the name of this class. It is provided as a user-friendly interface to laws.
|
|
|
|
|
|
|
protected: law* negate_law::deriv
(
|
|
|
int which
|
// variable to take
|
|
|
|
= 0
|
// derivative with
|
|
|
|
|
// respect to default
|
|
|
|
|
// value (X or A1)
|
|
|
) const;
|
|
|
This method returns a law pointer that is the derivative of the given law with respect to the
which variable. Variables in
C++ are numbered starting at zero (0). The default is to take a derivative with respect to the first variable, which in a law function string is
A1 or
X. The variables
X,
Y, and
Z are equivalent to the indices 0, 1, and 2, respectively.
|
|
|
The
deriv method implements the code to perform the actual derivative calculation and caches its value in memory. All classes derived from
law (or its children) must implement their own
deriv method.
|
|
|
The
deriv method should
not be called directly by applications. Applications should call the
derivative method instead, which is inherited by all classes derived from
law. The
derivative method accesses the cached derivative value in memory, if one exists; otherwise it calls the
deriv method.
|
|
|
|
|
|
|
public: void negate_law::evaluate
(
|
|
|
double const* x,
|
// values used in
|
|
|
|
|
// evaluation
|
|
|
double* answer
|
// multi-dimension answer
|
|
|
|
|
// range for evaluation
|
|
|
) const;
|
|
|
This method takes two pointers to memory that the caller is responsible for creating and freezing. The
x argument tells where to evaluate the law. This can be more than one dimension. The
answer argument returns the evaluation. This can be more than one dimension.
x should be the size returned by the
take_dim method, and
answer should be the size returned by the
return_dim method. All derived law classes must have this method or inherit it.
|
|
|
|
|
|
|
public: static int negate_law::id
();
|
|
|
This method should not be called directly by the application. All derived law classes must have this method. The
isa,
id, and and
type methods are used to identify a law's class type.
|
|
|
|
|
|
|
public: logical negate_law::isa
(
|
|
|
int t
|
// id method return
|
|
|
) const;
|
|
|
All derived law classes must have this method. The
isa,
id, and and
type methods are used to identify a law's class type. The methods should be the same for all law classes with the exception of the
isa method that calls the
isa method of its parent class. To test to see if a law is a given type, use
test_law->isa(constant_law::id()). If
test_law is a
constant_law or is derived from the
constant_law class, this returns
TRUE.
|
|
|
|
|
|
|
public: unary_law* negate_law::make_one
(
|
|
|
law* in_sublaw
|
// pointer to sublaw
|
|
|
) const;
|
|
|
Returns a pointer to a law of this type. Used by parsing to create an instance of this law.
|
|
|
|
|
|
|
public: law_polynomial* negate_law::polynomial
(
|
|
|
law* in
|
// input law
|
|
|
) const;
|
|
|
The
negate_law has its own rules for governing how the polynomial degree for a given top-level law is determined.
|
|
|
|
|
|
|
public: virtual law* negate_law::sub_simplify
(
|
|
|
int level
|
|
// level of
|
|
|
|
= 0,
|
|
// simplification
|
|
|
char const*& what
|
|
// text string
|
|
|
|
= * (char const** )
|
|
// describing the
|
|
|
|
NULL_REF
|
|
// simplified law
|
|
|
) const;
|
|
|
This is a member function that may be overloaded by derived classes to provide assistance to the simplifier. It helps the simplifier in dealing with this particular law. This method is called by the simplifier but generally not called directly by the application.
|
|
|
For example, a law class such as
plus_law might use an equation "x + x". The
sub_simplify method could return this equation as "2*x". The
sub_simplify method can access the private members of the law that the simplifier does not have access to. Most laws simply inherit a function that returns null.
|
|
|
|
|
|
|
public: char const* negate_law::symbol
(
|
|
|
law_symbol_type type
|
// type of law symbol
|
|
|
|
= DEFAULT
|
// standard ACIS type
|
|
|
) const;
|
|
|
Returns the string that represents this law class's symbol. The symbol is used for parsing the law and for saving and restoring law-based geometry. For a law to be saved and restored, it must have or inherit this method.
|
|
|
The default law symbol for this class is
-.
|
|
|
|
|
|
|
public: int negate_law::type
() const;
|
|
|
All derived law classes must have this method. The
isa,
id, and and
type methods are used to identify a law's class type. The methods should be the same for all law classes.
|
|
|
|
|
|
Related Fncs:
|
initialize_law, terminate_law
|