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
38CONTAINS
39
40 SUBROUTINE new_constants(Constants,units)
41 IMPLICIT NONE
42 !------------------------------------------------------------------------!
43 CLASS(constants_base), ALLOCATABLE :: Constants
44 !------------------------------------------------------------------------!
45 INTEGER :: units
46 !------------------------------------------------------------------------!
47
48 ! allocate data
49 SELECT CASE(units)
50 CASE(cgs)
51 ALLOCATE(constants_cgs::constants)
52 CASE(geometrical)
53 ALLOCATE(constants_geometrical::constants)
54 CASE(si)
55 ALLOCATE(constants_si::constants)
56 END SELECT
57
58 ! call initialization
59 SELECT TYPE(obj => constants)
60 TYPE IS (constants_cgs)
61 CALL obj%InitConstants_cgs()
62 TYPE IS (constants_geometrical)
63 CALL obj%InitConstants_geometrical()
64 TYPE IS (constants_si)
65 CALL obj%InitConstants_SI()
66 END SELECT
67 END SUBROUTINE
68END MODULE constants_generic_mod
generic module for units and physical constants
integer, parameter, public cgs
integer, parameter, public si
integer, parameter, public geometrical
module for cgs units and physical constants
constructor for constants class
subroutine new_constants(Constants, units)
module for geometrical units and physical constants
module for SI units and physical constants
physical constants data structure