reaction_solid_solution_aux.F90       coverage:  0.00 %func     0.00 %block


     1) module Reaction_Solid_Soln_Aux_module
     2)   
     3)   use Reaction_Mineral_Aux_module
     4) 
     5)   use PFLOTRAN_Constants_module
     6) 
     7)   implicit none
     8)   
     9)   private 
    10) 
    11) #include "petsc/finclude/petscsys.h"
    12) 
    13)   type, public :: solid_solution_type
    14)     character(len=MAXWORDLENGTH) :: name
    15)     PetscInt :: num_stoich_solid
    16)     character(len=MAXWORDLENGTH), pointer :: stoich_solid_names(:)
    17)     PetscInt, pointer :: stoich_solid_ids(:)
    18) #if 0
    19)     PetscInt :: num_end_member
    20)     type(stoichiometric_solid_type), pointer :: stoich_solid
    21) #endif    
    22)     type(solid_solution_type), pointer :: next
    23)   end type solid_solution_type
    24) 
    25) #if 0
    26)   type, public :: stoichiometric_solid_type
    27)     type(mineral_rxn_type), pointer :: mineral ! stoichiometric solid
    28)     type(mineral_rxn_type), pointer :: end_members
    29)     type(stoichiometric_solid_type), pointer :: next
    30)   end type stoichiometric_solid_type
    31)     
    32)   type, public :: solid_solution_rxn_type
    33)     character(len=MAXSTRINGLENGTH) :: database_filename
    34)     PetscInt :: num_dbase_temperatures
    35)     PetscReal, pointer :: dbase_temperatures(:)
    36)     type(solid_solution_type), pointer :: list
    37)     type(mineral_type), pointer :: mineral
    38)   end type solid_solution_rxn_type
    39) #endif
    40)   
    41)   public :: SolidSolutionCreate, &
    42)             SolidSolutionDestroy
    43)              
    44) contains
    45) 
    46) #if 0
    47) 
    48) ! ************************************************************************** !
    49) 
    50) function SolidSolutionReactionCreate()
    51)   ! 
    52)   ! Allocate and initialize solid solution reaction
    53)   ! object
    54)   ! 
    55)   ! Author: Glenn Hammond
    56)   ! Date: 08/16/12
    57)   ! 
    58) 
    59)   implicit none
    60)   
    61)   type(solid_solution_rxn_type), pointer :: SolidSolutionReactionCreate
    62)   
    63)   type(solid_solution_rxn_type), pointer :: solid_solution_rxn
    64) 
    65)   allocate(solid_solution_rxn)
    66)   
    67)   solid_solution_rxn%num_dbase_temperatures = 0
    68)   nullify(solid_solution_rxn%dbase_temperatures)
    69) 
    70)   nullify(solid_solution_rxn%list)
    71)   
    72)   solid_solution_rxn%mineral => MineralReactionCreate()
    73) 
    74)   SolidSolutionReactionCreate => solid_solution_rxn
    75)   
    76) end function SolidSolutionReactionCreate
    77) #endif
    78) 
    79) ! ************************************************************************** !
    80) 
    81) function SolidSolutionCreate()
    82)   ! 
    83)   ! Allocate and initialize solid solution object
    84)   ! 
    85)   ! Author: Glenn Hammond
    86)   ! Date: 08/17/12
    87)   ! 
    88) 
    89)   implicit none
    90)   
    91)   type(solid_solution_type), pointer :: SolidSolutionCreate
    92)   
    93)   type(solid_solution_type), pointer :: solid_solution
    94) 
    95)   allocate(solid_solution)
    96)   
    97)   solid_solution%name = ''
    98)   solid_solution%num_stoich_solid = 0
    99) #if 0  
   100)   solid_solution%num_end_member = 0
   101) #endif
   102) 
   103)   nullify(solid_solution%stoich_solid_names)
   104)   nullify(solid_solution%stoich_solid_ids)
   105)   nullify(solid_solution%next)
   106)   
   107)   SolidSolutionCreate => solid_solution
   108)   
   109) end function SolidSolutionCreate
   110) 
   111) #if 0
   112) 
   113) ! ************************************************************************** !
   114) 
   115) function StoichiometricSolidCreate()
   116)   ! 
   117)   ! Allocate and initialize stoichiometric solid
   118)   ! object
   119)   ! 
   120)   ! Author: Glenn Hammond
   121)   ! Date: 08/17/12
   122)   ! 
   123) 
   124)   implicit none
   125)   
   126)   type(stoichiometric_solid_type), pointer :: StoichiometricSolidCreate
   127)   
   128)   type(stoichiometric_solid_type), pointer :: stoich_solid
   129) 
   130)   allocate(stoich_solid)
   131)   
   132)   nullify(stoich_solid%mineral)
   133)   nullify(stoich_solid%end_members) ! nullify the list for now
   134)   nullify(stoich_solid%next)
   135)   
   136)   StoichiometricSolidCreate => stoich_solid
   137)   
   138) end function StoichiometricSolidCreate
   139) 
   140) ! ************************************************************************** !
   141) 
   142) subroutine StoichiometricSolidDestroy(stoich_solid)
   143)   ! 
   144)   ! Deallocates solid solution object
   145)   ! 
   146)   ! Author: Glenn Hammond
   147)   ! Date: 08/17/12
   148)   ! 
   149) 
   150)   implicit none
   151)   
   152)   type(stoichiometric_solid_type), pointer :: stoich_solid
   153)   
   154)   type(mineral_rxn_type), pointer :: cur_mineral, prev_mineral
   155) 
   156)   if (.not.associated(stoich_solid)) return
   157)   
   158)   ! Do not use recursion here as it may result in a large drain on the stack
   159) 
   160)   cur_mineral => stoich_solid%end_members
   161)   do
   162)     if (.not.associated(cur_mineral)) exit
   163)     prev_mineral => cur_mineral
   164)     cur_mineral => cur_mineral%next
   165)     call MineralDestroy(prev_mineral)
   166)   enddo    
   167)   call MineralDestroy(stoich_solid%mineral)
   168)   
   169)   deallocate(stoich_solid)
   170)   nullify(stoich_solid)
   171)   
   172) end subroutine StoichiometricSolidDestroy
   173) #endif
   174) 
   175) ! ************************************************************************** !
   176) 
   177) recursive subroutine SolidSolutionDestroy(solid_solution)
   178)   ! 
   179)   ! Deallocates solid solution object
   180)   ! 
   181)   ! Author: Glenn Hammond
   182)   ! Date: 08/17/12
   183)   ! 
   184) 
   185)   implicit none
   186)   
   187)   type(solid_solution_type), pointer :: solid_solution
   188)   
   189) #if 0  
   190)   type(stoichiometric_solid_type), pointer :: cur_stoich_solid, &
   191)                                               prev_stoich_solid
   192) #endif
   193) 
   194)   if (.not.associated(solid_solution)) return
   195)   
   196)   ! recursive
   197)   call SolidSolutionDestroy(solid_solution%next)
   198) 
   199) #if 0  
   200)   ! I don't want to destroy recursively here as the memory use may
   201)   ! be to large for large solid solutions
   202)   cur_stoich_solid => solid_solution%stoich_solid
   203)   do 
   204)     if (.not.associated(cur_stoich_solid)) exit
   205)     prev_stoich_solid => cur_stoich_solid
   206)     cur_stoich_solid => cur_stoich_solid%next
   207)     call StoichiometricSolidDestroy(prev_stoich_solid)
   208)   enddo
   209) #endif
   210)   deallocate(solid_solution%stoich_solid_names)
   211)   nullify(solid_solution%stoich_solid_names)
   212)   deallocate(solid_solution%stoich_solid_ids)
   213)   nullify(solid_solution%stoich_solid_ids)
   214)   
   215)   deallocate(solid_solution)
   216)   nullify(solid_solution)
   217)   
   218) end subroutine SolidSolutionDestroy
   219) 
   220) #if 0
   221) 
   222) ! ************************************************************************** !
   223) 
   224) subroutine SolidSolutionReactionDestroy(solid_solution)
   225)   ! 
   226)   ! Deallocates a solid solution object
   227)   ! 
   228)   ! Author: Glenn Hammond
   229)   ! Date: 08/16/12
   230)   ! 
   231) 
   232)   implicit none
   233) 
   234)   type(solid_solution_rxn_type), pointer :: solid_solution
   235)   
   236)   ! recursive
   237)   call SolidSolutionDestroy(solid_solution%list)
   238)   
   239)   deallocate(solid_solution)
   240)   nullify(solid_solution)
   241) 
   242) end subroutine SolidSolutionReactionDestroy
   243) #endif
   244) 
   245) end module Reaction_Solid_Soln_Aux_module

generated by
Intel(R) C++/Fortran Compiler code-coverage tool
Web-Page Owner: Nobody