[cig-commits] [commit] Hiro_latest: Add subroutines to copy field with arbitrary number of components (1ac80cf)

cig_noreply at geodynamics.org cig_noreply at geodynamics.org
Mon Nov 18 16:20:18 PST 2013


Repository : ssh://geoshell/calypso

On branch  : Hiro_latest
Link       : https://github.com/geodynamics/calypso/compare/93e9f8f974c7a247c8f02e54ec18de063f86c8fb...3c548304673360ddedd7d68c8095b3fb74a2b9ce

>---------------------------------------------------------------

commit 1ac80cf3e581e22068b4503720a784da32c24bf4
Author: Hiroaki Matsui <h_kemono at mac.com>
Date:   Wed Sep 18 09:00:45 2013 -0700

    Add subroutines to copy field with arbitrary number of components


>---------------------------------------------------------------

1ac80cf3e581e22068b4503720a784da32c24bf4
 .../SERIAL_src/BASE/copy_between_two_fields.f90    | 62 ++++++++++++++++++++++
 1 file changed, 62 insertions(+)

diff --git a/src/Fortran_libraries/SERIAL_src/BASE/copy_between_two_fields.f90 b/src/Fortran_libraries/SERIAL_src/BASE/copy_between_two_fields.f90
index 8612695..cd1fcf2 100644
--- a/src/Fortran_libraries/SERIAL_src/BASE/copy_between_two_fields.f90
+++ b/src/Fortran_libraries/SERIAL_src/BASE/copy_between_two_fields.f90
@@ -16,6 +16,9 @@
 !!      subroutine copy_tensor_2_tensor_fld                             &
 !!     &         (ifld_org, nnod_org, ntot_org_phys, d_org,             &
 !!     &          ifld_dst, nnod_dst, ntot_dst_phys, d_dst)
+!!      subroutine copy_fields_2_fields(numdir,                         &
+!!     &          ifld_org, nnod_org, ntot_org_phys, d_org,             &
+!!     &          ifld_dst, nnod_dst, ntot_dst_phys, d_dst)
 !!
 !!      subroutine fill_rest_scalar_field                               &
 !!     &         (ifld_org, nnod_org, ntot_org_phys, d_org,             &
@@ -26,8 +29,12 @@
 !!      subroutine fill_rest_tensor_field                               &
 !!     &         (ifld_org, nnod_org, ntot_org_phys, d_org,             &
 !!     &          ifld_dst, nnod_dst, ntot_dst_phys, d_dst)
+!!      subroutine fill_rest_fields(numdir,                             &
+!!     &          ifld_org, ist_fill, ntot_org_phys, d_org,             &
+!!     &          ifld_dst, numnod, ntot_dst_phys, d_dst)
 !!@endverbatim
 !!
+!!@param numdir          number of component
 !!@param ifld_org        field ID for original data
 !!@param nnod_org        number of node for original data
 !!@param ntot_org_phys   total number of components for original field
@@ -127,6 +134,34 @@
       end subroutine copy_tensor_2_tensor_fld
 !
 ! -------------------------------------------------------------------
+!
+      subroutine copy_fields_2_fields(numdir,                           &
+     &          ifld_org, nnod_org, ntot_org_phys, d_org,               &
+     &          ifld_dst, nnod_dst, ntot_dst_phys, d_dst)
+!
+      integer(kind = kint), intent(in) :: numdir
+      integer(kind = kint), intent(in) :: ifld_org, ifld_dst
+      integer(kind = kint), intent(in) :: nnod_org, ntot_org_phys
+      real(kind = kreal), intent(in) :: d_org(nnod_org,ntot_org_phys)
+      integer(kind = kint), intent(in) :: nnod_dst, ntot_dst_phys
+      real(kind=kreal), intent(inout) :: d_dst(nnod_dst,ntot_dst_phys)
+!
+      integer(kind = kint) :: inod, num, nd
+!
+      num = min(nnod_org, nnod_dst)
+!$omp parallel private(nd)
+      do nd = 1, numdir
+!$omp do
+        do inod = 1, num
+          d_dst(inod,ifld_dst+nd-1) = d_org(inod,ifld_org+nd-1)
+        end do
+!$omp end do nowait
+      end do
+!$omp end parallel
+!
+      end subroutine copy_fields_2_fields
+!
+! -------------------------------------------------------------------
 ! -------------------------------------------------------------------
 !
       subroutine fill_rest_scalar_field                                 &
@@ -204,4 +239,31 @@
 !
 ! -------------------------------------------------------------------
 !
+      subroutine fill_rest_fields(numdir,                               &
+     &          ifld_org, ist_fill, ntot_org_phys, d_org,               &
+     &          ifld_dst, numnod, ntot_dst_phys, d_dst)
+!
+      integer(kind = kint), intent(in) :: numdir
+      integer(kind = kint), intent(in) :: ifld_org, ifld_dst
+      integer(kind = kint), intent(in) :: ist_fill, ntot_org_phys
+      real(kind = kreal), intent(in) :: d_org(numnod,ntot_org_phys)
+      integer(kind = kint), intent(in) :: numnod, ntot_dst_phys
+      real(kind=kreal), intent(inout) :: d_dst(numnod,ntot_dst_phys)
+!
+      integer(kind = kint) :: inod
+!
+!$omp parallel private(nd)
+      do nd = 1, numdir
+!$omp do
+        do inod = ist_fill+1, numnod
+          d_dst(inod,ifld_dst+nd-1) = d_org(inod,ifld_org+nd-1)
+        end do
+!$omp end do nowait
+      end do
+!$omp end parallel
+!
+      end subroutine fill_rest_fields
+!
+! -------------------------------------------------------------------
+!
       end module copy_between_two_fields



More information about the CIG-COMMITS mailing list