Difference between revisions of "General Operations"

From LIBISIS
Jump to navigation Jump to search
m
m
Line 3: Line 3:
  
 
==IXFcreate==
 
==IXFcreate==
 +
This is a generic interface to the IXFcreate_class method.
 +
 +
The Create operation strictly takes all the elements required to define a class and creates the resulting object. If an element of the object is another class then it requires that the structure element is already valid. If you wish to define a class with a fewer number of elements than are in the structure, or if you wish to implicitly define a sub-object in the create operation then it will be necessary to overload the IXFcreate interface with your new subroutine. For example if you wish to create a dataset_1d object from just an x, signal and error array then you will have to write a subroutine for eg IXFcreate_xse_d1d and interface it to IXFcreate at the top of the IXMdataset_1d module.
 +
 +
 +
F90 syntax
 +
 +
  use IXMclass
 +
  type(IXTclass)::object
 +
 
 +
  various :: element_1,element_2,...,element_N
 +
 
 +
  call IXFcreate(object,element_1,element_2,...,element_N,status)
 +
 +
 +
for example with class=datum_array
 +
 +
  use IXMdatum_array
 +
  type(IXTdatum_array)::datumarray
 +
 
 +
  real(dp)::signal(30),error(30)
 +
 +
where signal and error are filled arrays
 +
 
 +
  ! using generic interface
 +
  call IXFcreate(datumarray,signal,error,status)
 +
 +
  ! using class specific method
 +
  call IXFcreate_datum_array(datumarray,signal,error,status)
 +
 
==IXFset==
 
==IXFset==
 
==IXFcheck==
 
==IXFcheck==
Line 15: Line 45:
  
 
===BinaryOperations===
 
===BinaryOperations===
 +
 
====IXFplus====
 
====IXFplus====
  
Line 35: Line 66:
  
  
For example with class=dataset_2d where w2,w2 are appropriately filled IXTdataset_2d objects and arrayd1d is an appropriately filled array of IXTdataset_1d objects.  
+
For example with class=dataset_2d where w2,w2 are appropriately filled [[IXTdataset_2d]] objects and arrayd1d is an appropriately filled array of [[IXTdataset_1d]] objects.  
  
 
  use IXMdataset_2d  
 
  use IXMdataset_2d  
Line 72: Line 103:
 
This is a generic interface to the IXFminus_class method.
 
This is a generic interface to the IXFminus_class method.
  
This subroutine will subtract two objects, an object from a scalar array of the same dimensionality (ie a 2d array to an IXTdataset_2d object) or an object from a scalar.
+
This subroutine will subtract two objects, an object from a scalar array of the same dimensionality (ie a 2d array to an [[IXTdataset_2d]] object) or an object from a scalar.
  
In the special case of an IXTdataset_2d object, it will subtract an array of IXTdataset_1d objects.
+
In the special case of an [[IXTdataset_2d]] object, it will subtract an array of IXTdataset_1d objects.
  
 
F90 syntax
 
F90 syntax
Line 88: Line 119:
  
  
For example with class=dataset_2d where w2,w2 are appropriately filled IXTdataset_2d objects and arrayd1d is an appropriately filled array of IXTdataset_1d objects.
+
For example with class=dataset_2d where w2,w2 are appropriately filled [[IXTdataset_2d]] objects and arrayd1d is an appropriately filled array of [[IXTdataset_1d]] objects.
  
 
  use IXMdataset_2d
 
  use IXMdataset_2d
Line 126: Line 157:
 
This is a generic interface to the IXFtimes_class method.
 
This is a generic interface to the IXFtimes_class method.
  
This subroutine will multiply together two objects, an object with a scalar array of the same dimensionality (ie a 2d array with an IXTdataset_2d object) or an object with a scalar.
+
This subroutine will multiply together two objects, an object with a scalar array of the same dimensionality (ie a 2d array with an [[IXTdataset_2d]] object) or an object with a scalar.
  
In the special case of an IXTdataset_2d object, it will multiply an array of IXTdataset_1d objects.
+
In the special case of an [[IXTdataset_2d]] object, it will multiply an array of [[IXTdataset_1d]] objects.
  
 
F90 syntax
 
F90 syntax
Line 142: Line 173:
  
  
For example with class=dataset_2d where w2,w2 are appropriately filled IXTdataset_2d objects and arrayd1d is an appropriately filled array of IXTdataset_1d objects.
+
For example with class=dataset_2d where w2,w2 are appropriately filled [[IXTdataset_2d]] objects and arrayd1d is an appropriately filled array of [[IXTdataset_1d]] objects.
  
  

Revision as of 10:43, 2 April 2008

These are generic subroutines which should be valid for every class


IXFcreate

This is a generic interface to the IXFcreate_class method.

The Create operation strictly takes all the elements required to define a class and creates the resulting object. If an element of the object is another class then it requires that the structure element is already valid. If you wish to define a class with a fewer number of elements than are in the structure, or if you wish to implicitly define a sub-object in the create operation then it will be necessary to overload the IXFcreate interface with your new subroutine. For example if you wish to create a dataset_1d object from just an x, signal and error array then you will have to write a subroutine for eg IXFcreate_xse_d1d and interface it to IXFcreate at the top of the IXMdataset_1d module.


F90 syntax

 use IXMclass
 type(IXTclass)::object
 
 various :: element_1,element_2,...,element_N
 
 call IXFcreate(object,element_1,element_2,...,element_N,status)


for example with class=datum_array

 use IXMdatum_array
 type(IXTdatum_array)::datumarray
 
 real(dp)::signal(30),error(30)

where signal and error are filled arrays

 ! using generic interface
 call IXFcreate(datumarray,signal,error,status)

 ! using class specific method
 call IXFcreate_datum_array(datumarray,signal,error,status)

IXFset

IXFcheck

IXFget

IXFget_alloc

IXFget_ptr

IXFdestroy

IXFcopy

Arithmetic Operations

These are specific subroutines which are valid on certain classes only

BinaryOperations

IXFplus

This is a generic interface to the IXFplus_class method.

This subroutine will add together two objects, an object to a scalar array of the same dimensionality (ie a 2d array to an IXTdataset_2d object) or an object to a scalar.

In the special case of an IXTdataset_2d object, it will add an array of IXTdataset_1d objects.

F90 syntax

use IXMclass
type(IXTclass)::class1,class2,result
real(dp)::scalar
type(IXTstatus)::status
:
call IXFplus(result,class1,class2,status)
call IXFplus(result,class1,scalar,status)
call IXFplus(result,scalar,class1,status)


For example with class=dataset_2d where w2,w2 are appropriately filled IXTdataset_2d objects and arrayd1d is an appropriately filled array of IXTdataset_1d objects.

use IXMdataset_2d 
use IXMdataset_1d
type(IXTdataset_2d):: w1,w2, wres
type(IXTdataset_1d):: arrayd1d(:)
real(dp)::scalar,scalar2d(:,:)
type(IXTstatus)::status
!using generic interface
! types/types and types/scalars
call IXFplus(wres,w1,w2,status) ! wres=w1+w2
call IXFplus(wres,scalar,w1,status) ! wres=scalar+w1
call IXFplus(wres,w1,scalar,status) ! wres=w1+scalar
! types/arrays
call IXFplus(wres,scalar2d,w1,status) ! wres=scalar2d+w1
call IXFplus(wres,w1,scalar2d,status) ! wres=w1+scalar2d
! types/arrays of types
call IXFplus(wres,arrayd1d,w2,status) ! wres=w2+arrayd1d
call IXFplus(wres,w2,arrayd1d,status) ! wres=arrayd1d+w2 

!using class specific method

! types/types and types/scalars
call IXFplus_dataset_2d(wres,w1,w2,status) ! wres=w1+w2
call IXFplus_dataset_2d(wres,scalar,w1,status) ! wres=scalar+w1
call IXFplus_dataset_2d(wres,w1,scalar,status) ! wres=w1+scalar
! types/arrays
call IXFplus_dataset_2d(wres,scalar2d,w1,status) ! wres=scalar2d+w1
call IXFplus_dataset_2d(wres,w1,scalar2d,status) ! wres=w1+scalar2d
! types/arrays of types
call IXFplus_dataset_2d(wres,arrayd1d,w2,status) ! wres=w2+arrayd1d
call IXFplus_dataset_2d(wres,w2,arrayd1d,status) ! wres=arrayd1d+w2 

IXFminus

This is a generic interface to the IXFminus_class method.

This subroutine will subtract two objects, an object from a scalar array of the same dimensionality (ie a 2d array to an IXTdataset_2d object) or an object from a scalar.

In the special case of an IXTdataset_2d object, it will subtract an array of IXTdataset_1d objects.

F90 syntax

use IXMclass
type(IXTclass)::class1,class2,result
real(dp)::scalar
type(IXTstatus)::status
:
call IXFminus(result,class1,class2,status)
call IXFminus(result,class1,scalar,status)
call IXFminus(result,scalar,class1,status)


For example with class=dataset_2d where w2,w2 are appropriately filled IXTdataset_2d objects and arrayd1d is an appropriately filled array of IXTdataset_1d objects.

use IXMdataset_2d
use IXMdataset_1d
type(IXTdataset_2d):: w1,w2, wres
type(IXTdataset_1d):: arrayd1d(:)
real(dp)::scalar,scalar2d(:,:)
type(IXTstatus)::status
:
!using generic interface
! types/types and types/scalars
call IXFminus(wres,w1,w2,status) ! wres=w1-w2
call IXFminus(wres,scalar,w1,status) ! wres=scalar-w1
call IXFminus(wres,w1,scalar,status) ! wres=w1-scalar
! types/arrays
call IXFminus(wres,scalar2d,w1,status) ! wres=scalar2d-w1
call IXFminus(wres,w1,scalar2d,status) ! wres=w1-scalar2d
! types/arrays of types
call IXFminus(wres,arrayd1d,w2,status) ! wres=w2-arrayd1d
call IXFminus(wres,w2,arrayd1d,status) ! wres=arrayd1d-w2 

!using class specific method
! types/types and types/scalars
call IXFminus_dataset_2d(wres,w1,w2,status) ! wres=w1-w2
call IXFminus_dataset_2d(wres,scalar,w1,status) ! wres=scalar-w1
call IXFminus_dataset_2d(wres,w1,scalar,status) ! wres=w1-scalar
! types/arrays
call IXFminus_dataset_2d(wres,scalar2d,w1,status) ! wres=scalar2d-w1
call IXFminus_dataset_2d(wres,w1,scalar2d,status) ! wres=w1-scalar2d
! types/arrays of types
call IXFminus_dataset_2d(wres,arrayd1d,w2,status) ! wres=w2-arrayd1d
call IXFminus_dataset_2d(wres,w2,arrayd1d,status) ! wres=arrayd1d-w2 


IXFtimes

This is a generic interface to the IXFtimes_class method.

This subroutine will multiply together two objects, an object with a scalar array of the same dimensionality (ie a 2d array with an IXTdataset_2d object) or an object with a scalar.

In the special case of an IXTdataset_2d object, it will multiply an array of IXTdataset_1d objects.

F90 syntax

use IXMclass
type(IXTclass)::class1,class2,result
real(dp)::scalar
type(IXTstatus)::status
:
call IXFtimes(result,class1,class2,status)
call IXFtimes(result,class1,scalar,status)
call IXFtimes(result,scalar,class1,status)


For example with class=dataset_2d where w2,w2 are appropriately filled IXTdataset_2d objects and arrayd1d is an appropriately filled array of IXTdataset_1d objects.


use IXMdataset_2d 
use IXMdataset_1d
type(IXTdataset_2d):: w1,w2, wres
type(IXTdataset_1d):: arrayd1d(:)
real(dp)::scalar,scalar2d(:,:)
type(IXTstatus)::status
:
!using generic interface
! types/types and types/scalars
call IXFtimes(wres,w1,w2,status) ! wres=w1*w2
call IXFtimes(wres,scalar,w1,status) ! wres=scalar*w1
call IXFtimes(wres,w1,scalar,status) ! wres=w1*scalar
! types/arrays
call IXFtimes(wres,scalar2d,w1,status) ! wres=scalar2d*w1
call IXFtimes(wres,w1,scalar2d,status) ! wres=w1*scalar2d
! types/arrays of types
call IXFtimes(wres,arrayd1d,w2,status) ! wres=w2*arrayd1d
call IXFtimes(wres,w2,arrayd1d,status) ! wres=arrayd1d*w2 

!using class specific method
! types/types and types/scalars
call IXFtimes_dataset_2d(wres,w1,w2,status) ! wres=w1*w2
call IXFtimes_dataset_2d(wres,scalar,w1,status) ! wres=scalar*w1
call IXFtimes_dataset_2d(wres,w1,scalar,status) ! wres=w1*scalar
! types/arrays
call IXFtimes_dataset_2d(wres,scalar2d,w1,status) ! wres=scalar2d*w1
call IXFtimes_dataset_2d(wres,w1,scalar2d,status) ! wres=w1*scalar2d
! types/arrays of types
call IXFtimes_dataset_2d(wres,arrayd1d,w2,status) ! wres=w2*arrayd1d
call IXFtimes_dataset_2d(wres,w2,arrayd1d,status) ! wres=arrayd1d*w2 


IXFdivide

This is a generic interface to the IXFdivide_class method.

This subroutine will divide one objects by another, an object by a scalar array of the same dimensionality (ie a 2d array by an IXTdataset_2d object) or an object by a scalar.

In the special case of an IXTdataset_2d object, it will divide an array of IXTdataset_1d objects.

F90 syntax


use IXMclass
type(IXTclass)::class1,class2,result
real(dp)::scalar
type(IXTstatus)::status
:
call IXFdivide(result,class1,class2,status)
call IXFdivide(result,class1,scalar,status)
call IXFdivide(result,scalar,class1,status)

For example with class=dataset_2d where w2,w2 are appropriately filled IXTdataset_2d objects and arrayd1d is an appropriately filled array of IXTdataset_1d objects.

use IXMdataset_2d 
use IXMdataset_1d
type(IXTdataset_2d):: w1,w2, wres
type(IXTdataset_1d):: arrayd1d(:)
real(dp)::scalar,scalar2d(:,:)
type(IXTstatus)::status
:
!using generic interface
! types/types and types/scalars
call IXFdivide(wres,w1,w2,status) ! wres=w1/w2
call IXFdivide(wres,scalar,w1,status) ! wres=scalar/w1
call IXFdivide(wres,w1,scalar,status) ! wres=w1/scalar
! types/arrays
call IXFdivide(wres,scalar2d,w1,status) ! wres=scalar2d/w1
call IXFdivide(wres,w1,scalar2d,status) ! wres=w1/scalar2d
! types/arrays of types
call IXFdivide(wres,arrayd1d,w2,status) ! wres=w2/arrayd1d
call IXFdivide(wres,w2,arrayd1d,status) ! wres=arrayd1d/w2 

!using class specific method
! types/types and types/scalars
call IXFdivide_dataset_2d(wres,w1,w2,status) ! wres=w1/w2
call IXFdivide_dataset_2d(wres,scalar,w1,status) ! wres=scalar/w1
call IXFdivide_dataset_2d(wres,w1,scalar,status) ! wres=w1/scalar
! types/arrays
call IXFdivide_dataset_2d(wres,scalar2d,w1,status) ! wres=scalar2d/w1
call IXFdivide_dataset_2d(wres,w1,scalar2d,status) ! wres=w1/scalar2d
! types/arrays of types
call IXFdivide_dataset_2d(wres,arrayd1d,w2,status) ! wres=w2/arrayd1d
call IXFdivide_dataset_2d(wres,w2,arrayd1d,status) ! wres=arrayd1d/w2 


IXFpower

This is a generic interface to the IXFpower_class method.


This subroutine will raise one object to the power of another object or an object to the power of a scalar.


F90 syntax

use IXMclass
type(IXTclass)::class1,class2,result
real(dp)::scalar
type(IXTstatus)::status
:
call IXFpower(result,class1,class2,status)
call IXFpower(result,class1,scalar,status)
call IXFpower(result,scalar,class1,status)
For example with class=dataset_2d where w2,w2 are appropriately filled IXTdataset_2d objects 
use IXMdataset_2d
type(IXTdataset_2d):: w1,w2, wres
real(dp)::scalar
type(IXTstatus)::status
:

!using generic interface

! types/types and types/scalars
call IXFpower(wres,w1,w2,status) ! wres=w1^w2
call IXFpower(wres,scalar,w1,status) ! wres=scalar^w1
call IXFpower(wres,w1,scalar,status) ! wres=w1^scalar

!using class specific method

! types/types and types/scalars
call IXFpower_dataset_2d(wres,w1,w2,status) ! wres=w1^w2
call IXFpower_dataset_2d(wres,scalar,w1,status) ! wres=scalar^w1
call IXFpower_dataset_2d(wres,w1,scalar,status) ! wres=w1^scalar 

UnaryOperations

There are eight different unary operations which can be performed on an object

The general calling syntax of the subroutine is (see below for further details):

call IXFoperation_class(result, object, status)

Each of these subroutines can also be called through the Unary Operations Interface.

Operations:

  • log - takes the natural logarithm of an object
  • exp - takes the exponential of an object
  • sin - takes the sine of an object
  • cos - takes the cosine of an object
  • tan - takes the tangent of an object
  • sinh - takes the hyperbolic sine of an object
  • cosh - takes the hyperbolic cosine of an object
  • tanh - takes the hyperbolic tangent of an object


Classes for which operations are valid:


F90 syntax

use IXMclass
type(IXTclass):: object, result
type(IXTstatus)::status
call IXFoperation_class(result,object,status)

For example with operation=sinh class=dataset_1d

use IXMdataset_1d

type(IXTdataset_1d):: w1, wres
type(IXTstatus)::status

call IXFsinh_dataset_1d(wres,w1,status)