Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Error 6355, 6549

cptfisher
Beginner
2,283 Views
Hi,

I receive the following erros when trying to compile a fortran mex file and wanted to see if anyone could help me solve the problem:

aerocalc.f90(96): error #6355: This binary operation is invalid for this data type. [TURBINECOMPONENTS]
y_output = (TurbineComponents) * 2
------------^
aerocalc.f90(96): error #6549: An arithmetic or LOGICAL type is required in this context.
y_output = (TurbineComponents) * 2
-------------------------------^
compilation aborted for aerocalc.f90 (code 1)

I just want to be able to pass the components to a simple fortran function.
TurbineComponents is type aeroconfig/marker which are the following:

TYPE :: Marker
REAL(8) :: Position(3)
REAL(8) :: Orientation(3,3) ! Direction Cosine Matrix (DCM)
REAL(8) :: TranslationVel(3)
REAL(8) :: RotationVel(3)
END TYPE Marker

TYPE :: AeroConfig
TYPE(Marker), ALLOCATABLE :: Blade(:)
REAL(8) :: BladeLength
TYPE(Marker) :: Hub
TYPE(Marker) :: RotorFurl
TYPE(Marker) :: Nacelle
TYPE(Marker) :: TailFin
TYPE(Marker) :: Tower
TYPE(Marker) :: Substructure
TYPE(Marker) :: Foundation
END TYPE AeroConfig


0 Kudos
1 Solution
Steven_L_Intel1
Employee
2,283 Views
You will have to write a function that accepts an argument of type AeroConfig, an argument of integer, and "multiplies" them, whatever that means. It might mean multiplying each of the REAL subcomponents of each component of type AeroConfig. This function would return a value of type AeroConfig that has the result. Then you'd declare an interface something like this:

interface operator(*)
module procedure my_multiply ! Or whatever you want to call it
end interface

This assumes you put this in a module - if not, you would include the specification of the function in the interface block.

Or you can just write your MEX-callable procedure to do the multiply directly rather than trying to express it as a multiply of a derived type by a constant.

View solution in original post

0 Kudos
5 Replies
bmchenry
New Contributor II
2,283 Views
need more information.
how you set it
and how you pass it/use it
and how it is defined in the called routine
from the error message you don't have it properly defined for the way you are using it!
0 Kudos
Steven_L_Intel1
Employee
2,283 Views
If I understand what you have written, TurbineComponents is a variable of derived type. There is no built-in definition of what it means to multiply a derived type variable, though you can define one. I don't see any function here, so I don't know what you are trying to accomplish.
0 Kudos
cptfisher
Beginner
2,283 Views
Sorry for the confusion. Yes, TurbineComponents is a variable of derived type. I want to be able to input the TurbineComponents by Matlab and then use the fortran mex file for the calculation:

Type(aeroconfig) :: TurbineComponents, y_output

and use the below subroutine in the mex file:

subroutine doublevector(y_output, TurbineComponents)

TYPE :: Marker
REAL(8) :: Position(3)
REAL(8) :: Orientation(3,3)
REAL(8) :: TranslationVel(3)
REAL(8) :: RotationVel(3)
END TYPE Marker

TYPE :: AeroConfig
TYPE(Marker), ALLOCATABLE :: Blade(:)
REAL(8) :: BladeLength
TYPE(Marker) :: Hub
TYPE(Marker) :: RotorFurl
TYPE(Marker) :: Nacelle
TYPE(Marker) :: TailFin
TYPE(Marker) :: Tower
TYPE(Marker) :: Substructure
TYPE(Marker) :: Foundation
END TYPE AeroConfig

Type(AeroConfig) :: TurbineComponents, y_output


y_output = (TurbineComponents) * 2


return
end

0 Kudos
Steven_L_Intel1
Employee
2,284 Views
You will have to write a function that accepts an argument of type AeroConfig, an argument of integer, and "multiplies" them, whatever that means. It might mean multiplying each of the REAL subcomponents of each component of type AeroConfig. This function would return a value of type AeroConfig that has the result. Then you'd declare an interface something like this:

interface operator(*)
module procedure my_multiply ! Or whatever you want to call it
end interface

This assumes you put this in a module - if not, you would include the specification of the function in the interface block.

Or you can just write your MEX-callable procedure to do the multiply directly rather than trying to express it as a multiply of a derived type by a constant.
0 Kudos
cptfisher
Beginner
2,283 Views
Thanks for your help Steve
0 Kudos
Reply