Skip to content

Commit

Permalink
Error mode with class cast to type
Browse files Browse the repository at this point in the history
  • Loading branch information
krystophny committed Nov 26, 2024
1 parent 8e92105 commit c84907e
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 13 deletions.
4 changes: 2 additions & 2 deletions examples/issue41_abstract_classes/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ test: wrapper
test_abstract_classes.x: main.f90 myclass_base.o myclass_impl.o myclass_factory.o
$(FC) $(FCFLAGS) -o $@ $^

wrapper: myclass_impl.o myclass_factory.o
wrapper: myclass_base.o myclass_impl.o myclass_factory.o
f90wrap -m itest -P myclass_impl.f90 myclass_factory.f90 -v
f2py-f90wrap --build-dir . -c -m _itest --opt="-O0 -g" \
f90wrap_myclass_impl.f90 f90wrap_myclass_factory.f90 \
myclass_impl.o myclass_factory.o \
myclass_base.o myclass_impl.o myclass_factory.o \
skip: myclass_impl_reference_storage myclass_impl_wrapper_t

%.o : %.f90
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
! Module myclass_factory defined in file myclass_factory.f90

subroutine f90wrap_myclass_factory__create_myclass(ret_myobject, impl_type)
use myclass_factory, only: create_myclass
use myclass_impl, only: myclass_impl_t
use myclass_factory, only: create_myclass
implicit none

type myclass_impl_t_ptr_type
Expand Down
2 changes: 1 addition & 1 deletion examples/issue41_abstract_classes/itest/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
import f90wrap.runtime
import logging
import numpy
import itest.myclass_impl
import itest.myclass_factory
import itest.myclass_impl

14 changes: 7 additions & 7 deletions examples/issue41_abstract_classes/itest/myclass_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Module myclass_impl
Defined at myclass_impl.f90 lines 1-16
Defined at myclass_impl.f90 lines 1-17
"""
from __future__ import print_function, absolute_import, division
Expand All @@ -20,15 +20,15 @@ class myclass_impl_t(f90wrap.runtime.FortranDerivedType):
Type(name=myclass_impl_t)
Defined at myclass_impl.f90 lines 3-6
Defined at myclass_impl.f90 lines 4-7
"""
def __del__(self):
"""
Destructor for class Myclass_Impl_T
Defined at myclass_impl.f90 lines 14-16
Defined at myclass_impl.f90 lines 15-17
Parameters
----------
Expand All @@ -43,7 +43,7 @@ def __del__(self):
Destructor for class Myclass_Impl_T
Defined at myclass_impl.f90 lines 14-16
Defined at myclass_impl.f90 lines 15-17
Parameters
----------
Expand All @@ -58,7 +58,7 @@ def __init__(self, handle=None):
self = Myclass_Impl_T()
Defined at myclass_impl.f90 lines 3-6
Defined at myclass_impl.f90 lines 4-7
Returns
Expand All @@ -78,7 +78,7 @@ def get_value(self):
value = get_value__binding__myclass_impl_t(self)
Defined at myclass_impl.f90 lines 9-12
Defined at myclass_impl.f90 lines 10-13
Parameters
----------
Expand All @@ -101,7 +101,7 @@ def get_value_impl(self):
value = get_value_impl(self)
Defined at myclass_impl.f90 lines 9-12
Defined at myclass_impl.f90 lines 10-13
Parameters
----------
Expand Down
2 changes: 1 addition & 1 deletion examples/issue41_abstract_classes/myclass_factory.f90
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module myclass_factory
contains

function create_myclass(impl_type) result(myobject)
type(myclass_impl_t), allocatable :: myobject
class(myclass_impl_t), allocatable :: myobject

character(*), intent(in) :: impl_type

Expand Down
3 changes: 2 additions & 1 deletion examples/issue41_abstract_classes/myclass_impl.f90
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
module myclass_impl

use myclass_base, only: myclass_t
implicit none

type :: myclass_impl_t
type, extends(myclass_t) :: myclass_impl_t
contains
procedure :: get_value => get_value_impl
final :: myclass_impl_finalise
Expand Down

0 comments on commit c84907e

Please sign in to comment.