marray_cellscalar.f90
Go to the documentation of this file.
1 !#############################################################################
2 !# #
3 !# fosite - 3D hydrodynamical simulation program #
4 !# module: marray_cellscalar.f90 #
5 !# #
6 !# Copyright (C) 2018 #
7 !# Tobias Illenseer <tillense@astrophysik.uni-kiel.de> #
8 !# #
9 !# This program is free software; you can redistribute it and/or modify #
10 !# it under the terms of the GNU General Public License as published by #
11 !# the Free Software Foundation; either version 2 of the License, or (at #
12 !# your option) any later version. #
13 !# #
14 !# This program is distributed in the hope that it will be useful, but #
15 !# WITHOUT ANY WARRANTY; without even the implied warranty of #
16 !# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or #
17 !# NON INFRINGEMENT. See the GNU General Public License for more #
18 !# details. #
19 !# #
20 !# You should have received a copy of the GNU General Public License #
21 !# along with this program; if not, write to the Free Software #
22 !# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. #
23 !# #
24 !#############################################################################
25 !----------------------------------------------------------------------------!
32 !----------------------------------------------------------------------------!
34  USE marray_base_mod
35  IMPLICIT NONE
36  !--------------------------------------------------------------------------!
37  PRIVATE
39  TYPE, EXTENDS(marray_base) :: marray_cellscalar
40  REAL, DIMENSION(:,:,:), POINTER :: center, & !< geometric center
41  bcenter
42 
43  REAL, DIMENSION(:,:,:,:), POINTER :: faces, & !< cell face centers
44  corners
45  CONTAINS
46  PROCEDURE :: assignpointers
47  END TYPE
48  INTERFACE marray_cellscalar
49  MODULE PROCEDURE createmarray_cellscalar
50  END INTERFACE
51  !--------------------------------------------------------------------------!
52  PUBLIC :: marray_cellscalar
53 
54 CONTAINS
55 
56  FUNCTION createmarray_cellscalar() RESULT(new_cs)
57  IMPLICIT NONE
58  !-------------------------------------------------------------------!
59  TYPE(marray_cellscalar) :: new_cs
60  !-------------------------------------------------------------------!
61  ! only set rank & dims - allocation is done, when cellvector is assigned (with =)
62  new_cs%DIMS(1) = 1+1+6+8
63  new_cs%DIMS(2) = 1
64  new_cs%RANK = 1
65  END FUNCTION createmarray_cellscalar
66 
67  SUBROUTINE assignpointers(this)
68  IMPLICIT NONE
69  !------------------------------------------------------------------------!
70  CLASS(marray_cellscalar),INTENT(INOUT) :: this
71  !------------------------------------------------------------------------!
72  CALL this%marray_base%AssignPointers()
73  ! assign array pointers
74  this%center => this%RemapBounds(this%data4d(:,:,:,1))
75  this%bcenter => this%RemapBounds(this%data4d(:,:,:,2))
76  this%faces => this%RemapBounds(this%data4d(:,:,:,3:8))
77  this%corners => this%RemapBounds(this%data4d(:,:,:,9:16))
78  END SUBROUTINE assignpointers
79 
80 END MODULE marray_cellscalar_mod
subroutine assignpointers(this)
assign pointers of different shapes to the 1D data
base class for mesh arrays
Definition: marray_base.f90:36
derived mesh array class for scalar cell data
basic mesh array class
Definition: marray_base.f90:64
type(marray_cellscalar) function createmarray_cellscalar()