As the error message says, the arguments to move_alloc must be allocatable. That's both of them. from is the first, and this must be allocatable for the allocation to move from it. You have Subroutine space_mvalloc (t, b) Class (SField), Intent (InOut) :: t Real, Intent (InOut) :: b(:,:,:) Call...
matrix,segmentation-fault,fortran,derived-types
After narrowing down the issue to using numbers vs. variables of those same numbers, it was discovered that Fortran doesn't like assigning a matrix to a matrix of different dimensions even if it fit inside. This was weird because smaller values of M, N, and Nblock got around the issue...
c#,interface,polymorphism,derived-types
Move the type parameter to the class level and add a constraint: public abstract class BaseDTO<T> where T : BaseEntity { protected abstract void ConvertFromEntity(T entity); public abstract T ConvertToEntity(); } public class DTODocNum : BaseDTO<DocNum> { ... } ...
c,pointers,fortran,fortran-iso-c-binding,derived-types
You can write some interoperable accessor procedures in Fortran that operate on the derived type and expose the necessary variables to the C++ code. This is very similar to how general C++ code interacts with private member variables of a class. You can use the C address of an object...
c#,reflection,nested,propertyinfo,derived-types
I am not sure what you are trying to accomplish and if it is the best way to do it. But I have changed the code so it works. I have not made it as dynamic as it can be... public class Base { public Prop prop { get; set;...
If your concern is about the duplication of arrays such as in m%ma = [...] ! Humongous array then Fortran 2003 offers the move_alloc intrinsic which moves the allocation (including the values) from one variable to another. Subroutine set (m, u, v, w) Class (Multia), Intent (InOut) :: m Real,...
fortran,fortran90,derived-types
The array of derived type is stored in the same column-major order. You may wonder where are the individual components stored. Their offset from the address of the array element is unspecified, the order can differ from the order of declaration and there may be various gaps between them. But...
What you try is not possible if your component is allocatable. The reference (6.1.2) is actually a reference to the official standard documents, which prohibits this. The reason is simple, the allocatable components (scalar or arrays) are stored in a different part of memory than the derived type itself. Therefore...
fortran,fortran90,derived-types
Yes. Declaring an explicit-shape array in a non-parameterized derived type requires a constant expression. You could either make k allocatable,dimension(:,:) (and (de-)allocation), or make nrx and maxprx global/module constants (or replace them right away). If your compiler supports it, you can use parameterized derived types: type :: PRM(nrx,maxprx) ! parameterized...