!---------------------------------------------------------------------------
! pmlib_mesh.f
!   version: 2D single-core
!---------------------------------------------------------------------------
!                  __    __
!    ___  _ _     / /__ / /
!   | _ \/ ` \ _ / // // _ \
!   | ,_/_,_,_\  \_/\_/\___/
!   |_|                      Mads M. Hejlesen* and Jens H. Walther*^
!                            * Technical University of Denmark
!                            ^ ETH-Zurich
!
!---------------------------------------------------------------------------
! Copyright (c) 2014 Technical University of Denmark, 
!                    Department of Mechanical Engineering
!
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
! the Free Software Foundation; either version 2 of the License, or
! (at your option) any later version.
! 
! This program is distributed in the hope that it will be useful,
! but WITHOUT ANY WARRANTY; without even the implied warranty of
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
! GNU General Public License for more details.
!
! You should have received a copy of the GNU General Public License
! along with this program; if not, see <http://www.gnu.org/licenses/>
!
! Contact: mmhej@mek.dtu.dk or jhwa@mek.dtu.dk
!---------------------------------------------------------------------------
MODULE pmlib_mod_mesh

USE pmlib_mod_parameters
USE pmlib_mod_write

IMPLICIT NONE

!---------------------------------------------------------------------------
! Define field class
!---------------------------------------------------------------------------
  TYPE class_mesh
! velocity (dim,x,y)
    REAL(MK),DIMENSION(:,:,:),POINTER       :: vel => NULL()
! vorticity (dim,x,y)
    REAL(MK),DIMENSION(:,:,:),POINTER       :: vort => NULL()
! material derivative of vorticity (dim,x,y)
    REAL(MK),DIMENSION(:,:,:),POINTER       :: dvort => NULL()
! poisson kernel fft
    COMPLEX(MKC),DIMENSION(:,:,:),POINTER   :: pkernel_fft => NULL()

! Penalisation variables
! penalisation velocity (dim,x,y)
    REAL(MK),DIMENSION(:,:,:),POINTER       :: vel_pen => NULL()
! characteristic function (1,x,y)
    REAL(MK),DIMENSION(:,:,:),POINTER       :: solid => NULL()
! velocity of solid (dim,x,y)
    REAL(MK),DIMENSION(:,:,:),POINTER       :: solid_vel => NULL()
  END TYPE class_mesh

!----------------------------------------------------------------------------
! Interfaces
!----------------------------------------------------------------------------
  INTERFACE pmlib_mesh_allocate
    MODULE PROCEDURE pmlib_mesh_allocate
  END INTERFACE

CONTAINS

#include "mesh/pmlib_mesh_allocate.f"

#include "mesh/pmlib_mesh_map.f"

#include "mesh/pmlib_mesh_map_interpolation.f"

#include "mesh/pmlib_mesh_map_ghost.f"


END MODULE pmlib_mod_mesh
