~reducedmodelling/fluidity/ROM_Non-intrusive-ann

« back to all changes in this revision

Viewing changes to assemble/Momentum_DG.F90

  • Committer: skramer
  • Date: 2010-11-16 15:37:38 UTC
  • Revision ID: svn-v4:5bf5533e-7014-46e3-b1bb-cce4b9d03719:trunk:2477
Changing the storage of vector_field from vfield%val(dim)%ptr(node) to vfield%val(dim,node).

This was a long desired and discussed change that should improve cache performance and will allow vector fields of more than 3 dimension (internally no vtk support). Just realised it could be done with a few simple seds.

Most important changes need:
- removal of wrap_field() for vector_fields.
- this required some surgery in vtk_write_fields, a horrible piece of code in any case
- traffic and mesh_movement were using wrap_field and now have to do a few more copies.
- halo_update() requires a contiguous buffer in memory, so a copy is now done for halo_update(vfield)
- the wrapped python vector fields available in python_state diagnostics had to be rewired to account for the new storage. This actually simplifies the wrapping a lot.

I realise this is a big commit which might give some trouble when merging in big changes (from for example a branch). The following little script I used might be handy for this. You might only want to apply it to files you have modified. Make sure you back up your entire local checkout before applying any of these:

#/bin/sh
FILES=*/*.F90 */tests/*.F90
# replace any %val(1)%ptr(2) where 2 contains a pair of ()
sed -i 's!%val(\([A-Za-z0-9%_\+\* -]*\))%ptr(\([^)]*([^)]*)[^)]*\))!%val(\1,\2)!g' ${FILES}
# replace any %val(1)%ptr(2) where 2 contains no closing )
sed -i 's!%val(\([A-Za-z0-9%_\+\* -]*\))%ptr(\([^)]*\))!%val(\1,\2)!g' ${FILES}
# replace any %val(1)%ptr not followed by (
sed -i 's!%val(\([A-Za-z0-9%_\+\* -]*\))%ptr!%val(\1,:)!g' ${FILES}
# now svn revert femtools/Sparse_Tools.F90
# as it gives false positives for dcsr_matrices
# luckily it doesn't use vector_fields, so we can just revert


Show diffs side-by-side

added added

removed removed

Lines of Context:
318
318
       ! Grab an extra reference to cause the deallocate below to be safe.
319
319
       call incref(Source)
320
320
      do dim = 1, source%dim
321
 
        ewrite_minmax(source%val(dim)%ptr(:))
 
321
        ewrite_minmax(source%val(dim,:))
322
322
      end do
323
323
    end if
324
324
 
331
331
       ! Grab an extra reference to cause the deallocate below to be safe.
332
332
       call incref(Abs)
333
333
       do dim = 1, abs%dim
334
 
         ewrite_minmax(Abs%val(dim)%ptr(:))
 
334
         ewrite_minmax(Abs%val(dim,:))
335
335
       end do
336
336
    end if
337
337
 
664
664
    if (present(inverse_masslump) .and. lump_mass) then
665
665
      call apply_dirichlet_conditions_inverse_mass(inverse_masslump, u)
666
666
      do dim = 1, rhs%dim
667
 
         ewrite_minmax(inverse_masslump%val(dim)%ptr)
 
667
         ewrite_minmax(inverse_masslump%val(dim,:))
668
668
      end do
669
669
    end if
670
670
    if (present(inverse_mass) .and. .not. lump_mass) then
674
674
      end do
675
675
    end if
676
676
    do dim = 1, rhs%dim
677
 
      ewrite_minmax(rhs%val(dim)%ptr(:))
 
677
      ewrite_minmax(rhs%val(dim,:))
678
678
    end do
679
679
 
680
680
    ! Drop the reference to the fields we may have made.
2853
2853
    end do
2854
2854
 
2855
2855
    do d = 1, delta_u%dim
2856
 
      ewrite_minmax(delta_u%val(d)%ptr(:))
 
2856
      ewrite_minmax(delta_u%val(d,:))
2857
2857
    end do
2858
2858
 
2859
2859
    !update RHS of momentum equation
3115
3115
 
3116
3116
    call halo_update(u)
3117
3117
    do dim = 1, u%dim
3118
 
      ewrite_minmax(u%val(dim)%ptr(:))
 
3118
      ewrite_minmax(u%val(dim,:))
3119
3119
    end do
3120
3120
 
3121
3121
    call deallocate(delta_U1)