marray_cellvector.f90
Go to the documentation of this file.
1!#############################################################################
2!# #
3!# fosite - 3D hydrodynamical simulation program #
4!# module: marray_cellvector.f90 #
5!# #
6!# Copyright (C) 2018,2021 #
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!----------------------------------------------------------------------------!
35 IMPLICIT NONE
36 !--------------------------------------------------------------------------!
37 PRIVATE
40 REAL, DIMENSION(:,:,:,:), POINTER &
41 :: center => null(), &
42 bcenter => null()
43
44 REAL, DIMENSION(:,:,:,:,:), POINTER &
45 :: faces => null(), &
46 corners => null()
47 CONTAINS
48 PROCEDURE :: assignpointers
49 final :: finalize
50 END TYPE
51 INTERFACE marray_cellvector
52 MODULE PROCEDURE createmarray_cellvector
53 END INTERFACE
54 !--------------------------------------------------------------------------!
55 PUBLIC :: marray_cellvector
56
57CONTAINS
58
59 FUNCTION createmarray_cellvector() RESULT(new_cv)
60 IMPLICIT NONE
61 !-------------------------------------------------------------------!
62 TYPE(marray_cellvector) :: new_cv
63 !-------------------------------------------------------------------!
64#if DEBUG > 2
65 print *,"DEBUG INFO in marray_cellvector::CreateMArray_cellvector: new cellvector"
66#endif
67 ! 1 center + 1 bcenter + 6 faces + 8 corners = 16
68 IF (new_cv%Init(16,3)) return ! immediately return if successful
69#ifdef DEBUG
70 print *,"ERROR in marray_cellvector::CreateMArray: cellvector initialization failed"
71 stop 1
72#endif
73 END FUNCTION createmarray_cellvector
74
75 FUNCTION assignpointers(this) RESULT(success)
76 IMPLICIT NONE
77 !------------------------------------------------------------------------!
78 CLASS(marray_cellvector),INTENT(INOUT) :: this
79 LOGICAL :: success
80 !------------------------------------------------------------------------!
81#if DEBUG > 2
82 print *,"DEBUG INFO in marray_cellvector::AssignPointers: assigning pointers"
83#endif
84 success = this%marray_base%AssignPointers()
85 ! assign array pointers
86 IF (success) THEN
87 this%center => this%RemapBounds(this%data5d(:,:,:,1,:))
88 this%bcenter => this%RemapBounds(this%data5d(:,:,:,2,:))
89 this%faces => this%RemapBounds(this%data5d(:,:,:,3:8,:))
90 this%corners => this%RemapBounds(this%data5d(:,:,:,9:16,:))
91#ifdef DEBUG
92 ELSE
93 print *,"ERROR in marray_cellvector::AssignPointers: pointer assignment failed"
94#endif
95 END IF
96 END FUNCTION assignpointers
97
100 SUBROUTINE finalize(this)
101 IMPLICIT NONE
102 !-------------------------------------------------------------------!
103 TYPE(marray_cellvector) :: this
104 !-------------------------------------------------------------------!
105#if DEBUG > 2
106 print *,"DEBUG INFO in marray_cellvector::Finalize: nullify pointers"
107#endif
108 NULLIFY(this%center,this%bcenter,this%faces,this%corners)
109 END SUBROUTINE finalize
110
111END MODULE marray_cellvector_mod
base class for mesh arrays
Definition: marray_base.f90:36
logical function assignpointers(this)
assign pointers of different shapes to the 1D data
subroutine finalize(this)
derived mesh array class for vector cell data
type(marray_cellvector) function createmarray_cellvector()
basic mesh array class
Definition: marray_base.f90:69