Skip to content

Commit

Permalink
Merge pull request #32 from Goddard-Fortran-Ecosystem/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
tclune authored Oct 25, 2018
2 parents c81690a + 939e228 commit 747e3cb
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 11 deletions.
4 changes: 2 additions & 2 deletions cmake_utils/GNU.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ set(traceback "-fbacktrace")
set(cpp "-cpp")


set(CMAKE_Fortran_FLAGS_DEBUG "${no_optimize}")
set(CMAKE_Fortran_FLAGS_DEBUG "${no_optimize}" ${check_all} ${traceback})
set(CMAKE_Fortran_FLAGS_RELEASE "-O3")
set(CMAKE_Fortran_FLAGS "-g ${cpp} ${traceback} ${check_all}")
set(CMAKE_Fortran_FLAGS "-g ${cpp} -ffree-line-length-255")
15 changes: 15 additions & 0 deletions include/templates/altSet_impl.inc
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,9 @@
__type_declare_result, pointer :: p, q
#endif

#if (defined(__vector_debug) && defined(_DEBUG___))
print*,__FILE__,__LINE__
#endif
if (present(unused)) print*,shape(unused)

if (exists(this%root)) then
Expand Down Expand Up @@ -287,7 +290,13 @@
isNew = .true.
end if

#if (defined(__vector_debug) && defined(_DEBUG___))
print*,__FILE__,__LINE__, this%next_free
#endif
if (this%next_free == 0) then
#if (defined(__vector_debug) && defined(_DEBUG___))
print*,__FILE__,__LINE__
#endif
call this%items%push_back(value)
new = this%items%size()
call this%heights%push_back(1_SIZE_KIND)
Expand Down Expand Up @@ -315,6 +324,9 @@
call this%rights%set(parent,new)
end if
#else
#if (defined(__vector_debug) && defined(_DEBUG___))
print*,__FILE__,__LINE__
#endif
if (__PROC(lessThan)(value, this%items%at(parent))) then
call this%lefts%set(parent, new)
else
Expand All @@ -325,6 +337,9 @@

else ! new root

#if (defined(__vector_debug) && defined(_DEBUG___))
print*,__FILE__,__LINE__, this%next_free
#endif
if (this%next_free == 0) then
call this%items%push_back(value)
new = this%items%size()
Expand Down
7 changes: 4 additions & 3 deletions include/templates/map.inc
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,6 @@
#undef __container_prefix

#define _type type(__pair)
#ifdef _pair_allocatable
#define _allocatable
#endif

#include "templates/type_set_use_tokens.inc"

Expand Down Expand Up @@ -156,6 +153,10 @@

#include "templates/type_set_use_tokens.inc"

#define __USE_ASSIGN(dest,src) dest=src
#define __USE_MOVE(dest,src) __KEY_MOVE(dest%key,src%key); __VALUE_MOVE(dest%value,src%value)
#define __USE_FREE(x)

#ifdef _alt
! vector<_type>
# define __vector tVector
Expand Down
10 changes: 5 additions & 5 deletions include/templates/vector_impl.inc
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@
! =======================
subroutine __PROC(insert_size_kind)( &
& this, index, value, unused, rc)
class(__vector), intent(inout) :: this
class(__vector), target, intent(inout) :: this

integer(kind=SIZE_KIND), intent(in) :: index

Expand Down Expand Up @@ -628,9 +628,9 @@
! set_capacity
! =======================
subroutine __PROC(set_capacity)(this, capacity)
class(__vector), intent(inout) :: this
class(__vector), target, intent(inout) :: this
integer(kind=SIZE_KIND), intent(in) :: capacity ! capacity must be >=0
__declare_element_type, dimension(:), allocatable :: temp
__declare_element_type,dimension(:),allocatable,target :: temp
integer(kind=SIZE_KIND) :: i

if (capacity>0) then ! capacity>0
Expand Down Expand Up @@ -669,8 +669,8 @@
! swap
! =======================
subroutine __PROC(swap)(this, other)
class(__vector), intent(inout) :: this
type(__vector), intent(inout) :: other
class(__vector), target, intent(inout) :: this
type(__vector), target, intent(inout) :: other
__declare_element_type, &
& dimension(:), allocatable :: tmpelementsfer
integer :: tmpsize
Expand Down
6 changes: 5 additions & 1 deletion tests/Map/Test_map_Allocatable.pf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ module MyMap_mod
#include "types/key_deferredLengthString.inc"
#include "types/value_FooPoly.inc"
#define _alt
#define _pair_allocatable
#include "templates/map.inc"
end module MyMap_mod
Expand All @@ -36,10 +35,15 @@ contains
call m%insert('c',Foo(3))
pc => m%at('c')
@assertEqual(3, pc%i)
call m%insert('b',Foo(2))
pb => m%at('b')
@assertEqual(2, pb%i)
call m%insert('a',Foo(1))
pa => m%at('a')
@assertEqual(1, pa%i)
! Sanity checks
@assertEqual(1, pa%i)
Expand Down

0 comments on commit 747e3cb

Please sign in to comment.