~fluidity-core/fluidity/les-dg

« back to all changes in this revision

Viewing changes to tools/project_to_continuous.F90

  • Committer: Jon Hill
  • Date: 2011-09-12 10:01:59 UTC
  • mfrom: (3575.1.2 proj_cont_fix)
  • Revision ID: jon.hill@imperial.ac.uk-20110912100159-1per0ppfkizb2o9o
Moving project_to_continuous over to iso-c bindings. This fixes an odd memory error in the old version

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
#include "confdefs.h"
28
28
#include "fdebug.h"
29
29
 
30
 
subroutine project_to_continuous(vtuname, vtuname_len, meshname,&
31
 
     & meshname_len) 
 
30
subroutine project_to_continuous(vtuname_, vtuname_len, meshname_,&
 
31
     & meshname_len) bind(c)
32
32
  !!< Given a vtu file containing fields on a discontinuous mesh, and the
33
33
  !!< triangle files for the corresponding continuous mesh, produce a vtu
34
34
  !!< with its fields projected onto the continuous mesh.
40
40
  use sparse_tools
41
41
  use fefields
42
42
  use sparse_matrices_fields
 
43
  use iso_c_binding
43
44
  implicit none
44
 
  integer, intent(in):: vtuname_len, meshname_len
45
 
  character(len=vtuname_len), intent(in):: vtuname
46
 
  character(len=meshname_len), intent(in):: meshname
 
45
 
 
46
  character(kind=c_char, len=1) :: vtuname_(*)
 
47
  integer(kind=c_size_t), value :: vtuname_len
 
48
  character(kind=c_char, len=1) :: meshname_(*)
 
49
  integer(kind=c_size_t), value :: meshname_len
 
50
 
 
51
  character(len=vtuname_len):: vtuname
 
52
  character(len=meshname_len):: meshname
47
53
 
48
54
  type(state_type) :: dg_state, cg_state
49
55
  type(vector_field) :: cg_coordinate
56
62
 
57
63
  integer :: i, j, k
58
64
 
 
65
! now turn into proper fortran strings (is there an easier way to do this?)
 
66
  do i=1, vtuname_len
 
67
    vtuname(i:i)=vtuname_(i)
 
68
  end do
 
69
  do i=1, meshname_len
 
70
    meshname(i:i)=meshname_(i)
 
71
  end do
 
72
 
59
73
  call vtk_read_state(vtuname, dg_state, quad_degree=6)
60
74
  
61
75
  cg_coordinate= read_mesh_files(meshname, quad_degree=6)