constants_generic.f90
Go to the documentation of this file.
1 !#############################################################################
2 !# #
3 !# fosite - 3D hydrodynamical simulation program #
4 !# module: mesh_generic.f90 #
5 !# #
6 !# Copyright (C) 2016 Manuel Jung <mjung@astrophysik.uni-kiel.de> #
7 !# #
8 !# This program is free software; you can redistribute it and/or modify #
9 !# it under the terms of the GNU General Public License as published by #
10 !# the Free Software Foundation; either version 2 of the License, or (at #
11 !# your option) any later version. #
12 !# #
13 !# This program is distributed in the hope that it will be useful, but #
14 !# WITHOUT ANY WARRANTY; without even the implied warranty of #
15 !# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or #
16 !# NON INFRINGEMENT. See the GNU General Public License for more #
17 !# details. #
18 !# #
19 !# You should have received a copy of the GNU General Public License #
20 !# along with this program; if not, write to the Free Software #
21 !# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. #
22 !# #
23 !#############################################################################
24 !----------------------------------------------------------------------------!
31 !----------------------------------------------------------------------------!
37  USE common_dict
38 
39 CONTAINS
40 
41  SUBROUTINE new_constants(Constants,units)
42  IMPLICIT NONE
43  !------------------------------------------------------------------------!
44  CLASS(constants_base), ALLOCATABLE :: Constants
45  !------------------------------------------------------------------------!
46  INTEGER :: units
47  !------------------------------------------------------------------------!
48 
49  ! allocate data
50  SELECT CASE(units)
51  CASE(cgs)
52  ALLOCATE(constants_cgs::constants)
53  CASE(geometrical)
54  ALLOCATE(constants_geometrical::constants)
55  CASE(si)
56  ALLOCATE(constants_si::constants)
57  END SELECT
58 
59  ! call initialization
60  SELECT TYPE(obj => constants)
61  TYPE IS (constants_cgs)
62  CALL obj%InitConstants_cgs()
63  TYPE IS (constants_geometrical)
64  CALL obj%InitConstants_geometrical()
65  TYPE IS (constants_si)
66  CALL obj%InitConstants_SI()
67  END SELECT
68  END SUBROUTINE
69 END MODULE constants_generic_mod
module for cgs units and physical constants
integer, parameter, public si
module for SI units and physical constants
generic module for units and physical constants
Dictionary for generic data types.
Definition: common_dict.f90:61
subroutine new_constants(Constants, units)
constructor for constants class
module for geometrical units and physical constants
integer, parameter, public geometrical
integer, parameter, public cgs