libsim  Versione6.3.0

◆ grid_transform_vol7d_vol7d_init()

subroutine grid_transform_class::grid_transform_vol7d_vol7d_init ( type(grid_transform), intent(out)  this,
type(transform_def), intent(in)  trans,
type(vol7d), intent(in)  v7d_in,
type(vol7d), intent(inout)  v7d_out,
character(len=*), intent(in), optional  categoryappend 
)
private

Constructor for a grid_transform object, defining a particular sparse points-to-sparse points transformation.

It defines an object describing a transformation from a set of sparse points to a set of sparse points; the abstract type of transformation is described in the transformation object trans (type transform_def) which must have been properly initialised. The additional information required here is the list of the input sparse points in the form of a vol7d object (parameter v7d_in), which can be the same volume that will be successively used for interpolation, or a volume with just the same coordinate data, and, if required by the transformation type, the information about the target sparse points over which the transformation should take place:

  • for 'inter' transformation, this is provided in the form of a vol7d object (v7d_out argument, input), which must have been initialized with the coordinates of desired sparse points
  • for 'polyinter' transformation, no target point information has to be provided in input (it is calculated on the basis of input grid and trans object), and the coordinates of the target points (polygons' centroids) are returned in output in v7d_out argument
  • for 'metamorphosis' transformation, no target point information has to be provided in input (it is calculated on the basis of input grid and trans object), and, as for 'polyinter', this information is returned in output in v7d_out argument.

The generated grid_transform object is specific to the input and output sparse point lists provided or computed. The function c_e can be used in order to check whether the object has been successfully initialised, if the result is .FALSE., it should not be used further on.

Parametri
[out]thisgrid_transformation object
[in]transtransformation object
[in]v7d_invol7d object with the coordinates of the sparse point to be used as input (only information about coordinates is used)
[in,out]v7d_outvol7d object with the coordinates of the sparse points to be used as transformation target (input or output depending on type of transformation, when output, it must have been initialised anyway)
[in]categoryappendappend this suffix to log4fortran namespace category

Definizione alla linea 2548 del file grid_transform_class.F90.

2548 
2552 SUBROUTINE grid_transform_delete(this)
2553 TYPE(grid_transform),INTENT(inout) :: this
2554 
2555 CALL delete(this%trans)
2556 
2557 this%innx=imiss
2558 this%inny=imiss
2559 this%outnx=imiss
2560 this%outny=imiss
2561 this%iniox=imiss
2562 this%inioy=imiss
2563 this%infox=imiss
2564 this%infoy=imiss
2565 this%outinx=imiss
2566 this%outiny=imiss
2567 this%outfnx=imiss
2568 this%outfny=imiss
2569 
2570 if (associated(this%inter_index_x)) deallocate (this%inter_index_x)
2571 if (associated(this%inter_index_y)) deallocate (this%inter_index_y)
2572 if (associated(this%inter_index_z)) deallocate (this%inter_index_z)
2573 if (associated(this%point_index)) deallocate (this%point_index)
2574 
2575 if (associated(this%inter_x)) deallocate (this%inter_x)
2576 if (associated(this%inter_y)) deallocate (this%inter_y)
2577 
2578 if (associated(this%inter_xp)) deallocate (this%inter_xp)
2579 if (associated(this%inter_yp)) deallocate (this%inter_yp)
2580 if (associated(this%inter_zp)) deallocate (this%inter_zp)
2581 if (associated(this%vcoord_in)) deallocate (this%vcoord_in)
2582 if (associated(this%vcoord_out)) deallocate (this%vcoord_out)
2583 if (associated(this%point_mask)) deallocate (this%point_mask)
2584 if (associated(this%stencil)) deallocate (this%stencil)
2585 if (associated(this%output_level_auto)) deallocate (this%output_level_auto)
2586 IF (ALLOCATED(this%coord_3d_in)) DEALLOCATE(this%coord_3d_in)
2587 this%valid = .false.
2588 
2589 ! close the logger
2590 call l4f_category_delete(this%category)
2591 
2592 END SUBROUTINE grid_transform_delete
2593 
2594 
2599 SUBROUTINE grid_transform_get_val(this, output_level_auto, point_mask, &
2600  point_index, output_point_index, levshift, levused)
2601 TYPE(grid_transform),INTENT(in) :: this
2602 TYPE(vol7d_level),POINTER,OPTIONAL :: output_level_auto(:)
2603 LOGICAL,INTENT(out),ALLOCATABLE,OPTIONAL :: point_mask(:)
2604 INTEGER,INTENT(out),ALLOCATABLE,OPTIONAL :: point_index(:)
2605 INTEGER,INTENT(out),ALLOCATABLE,OPTIONAL :: output_point_index(:)
2606 INTEGER,INTENT(out),OPTIONAL :: levshift
2607 INTEGER,INTENT(out),OPTIONAL :: levused
2608 
2609 INTEGER :: i
2610 
2611 IF (PRESENT(output_level_auto)) output_level_auto => this%output_level_auto
2612 IF (PRESENT(point_mask)) THEN
2613  IF (ASSOCIATED(this%point_index)) THEN
2614  point_mask = c_e(reshape(this%point_index, (/SIZE(this%point_index)/)))
2615  ENDIF
2616 ENDIF
2617 IF (PRESENT(point_index)) THEN
2618  IF (ASSOCIATED(this%point_index)) THEN
2619  point_index = reshape(this%point_index, (/SIZE(this%point_index)/))
2620  ENDIF
2621 ENDIF
2622 IF (PRESENT(output_point_index)) THEN
2623  IF (ASSOCIATED(this%point_index)) THEN
2624 ! metamorphosis, index is computed from input origin of output point
2625  output_point_index = pack(this%point_index(:,:), c_e(this%point_index))
2626  ELSE IF (this%trans%trans_type == 'polyinter' .OR. &
2627  this%trans%trans_type == 'maskinter') THEN
2628 ! other cases, index is order of output point
2629  output_point_index = (/(i,i=1,this%outnx)/)
2630  ENDIF
2631 ENDIF
2632 IF (PRESENT(levshift)) levshift = this%levshift
2633 IF (PRESENT(levused)) levused = this%levused
2634 
2635 END SUBROUTINE grid_transform_get_val
2636 
2637 
2640 FUNCTION grid_transform_c_e(this)
2641 TYPE(grid_transform),INTENT(in) :: this
2642 LOGICAL :: grid_transform_c_e
2643 
2644 grid_transform_c_e = this%valid
2645 
2646 END FUNCTION grid_transform_c_e
2647 
2648 
2658 RECURSIVE SUBROUTINE grid_transform_compute(this, field_in, field_out, var, &
2659  coord_3d_in)
2660 TYPE(grid_transform),INTENT(in),TARGET :: this
2661 REAL,INTENT(in) :: field_in(:,:,:)
2662 REAL,INTENT(out) :: field_out(:,:,:)
2663 TYPE(vol7d_var),INTENT(in),OPTIONAL :: var
2664 REAL,INTENT(in),OPTIONAL,TARGET :: coord_3d_in(:,:,:)
2665 
2666 INTEGER :: i, j, k, ii, jj, ie, je, n, navg, kk, kkcache, kkup, kkdown, &
2667  kfound, kfoundin, inused, i1, i2, j1, j2, np, ns
2668 INTEGER,ALLOCATABLE :: nval(:,:)
2669 REAL :: z1,z2,z3,z4,z(4)
2670 DOUBLE PRECISION :: x1,x3,y1,y3,xp,yp
2671 INTEGER :: innx, inny, innz, outnx, outny, outnz, vartype
2672 REAL,ALLOCATABLE :: coord_in(:)
2673 LOGICAL,ALLOCATABLE :: mask_in(:)
2674 REAL,ALLOCATABLE :: val_in(:), field_tmp(:,:,:)
2675 REAL,POINTER :: coord_3d_in_act(:,:,:)
2676 TYPE(grid_transform) :: likethis
2677 LOGICAL :: alloc_coord_3d_in_act, nm1
2678 
2679 
2680 #ifdef DEBUG
2681 CALL l4f_category_log(this%category,l4f_debug,"start grid_transform_compute")
2682 #endif
2683 
2684 field_out(:,:,:) = rmiss
2685 
2686 IF (.NOT.this%valid) THEN
2687  CALL l4f_category_log(this%category,l4f_error, &
2688  "refusing to perform a non valid transformation")
2689  RETURN
2690 ENDIF
2691 
2692 IF (this%recur) THEN ! if recursive transformation, recur here and exit
2693 #ifdef DEBUG
2694  CALL l4f_category_log(this%category,l4f_debug, &
2695  "recursive transformation in grid_transform_compute")
2696 #endif
2697 
2698  IF (this%trans%trans_type == 'polyinter') THEN
2699  likethis = this
2700  likethis%recur = .false.
2701  likethis%outnx = this%trans%poly%arraysize
2702  likethis%outny = 1
2703  ALLOCATE(field_tmp(this%trans%poly%arraysize,1,SIZE(field_out,3)))
2704  CALL grid_transform_compute(likethis, field_in, field_tmp, var)
2705 
2706  DO k = 1, SIZE(field_out,3)
2707  DO j = 1, this%inny
2708  DO i = 1, this%innx
2709  IF (c_e(this%inter_index_x(i,j))) THEN
2710  field_out(i,j,k) = field_tmp(this%inter_index_x(i,j),this%inter_index_y(i,j),k)
2711  ENDIF
2712  ENDDO
2713  ENDDO
2714  ENDDO
2715  DEALLOCATE(field_tmp)
2716  ENDIF
2717 
2718  RETURN
2719 ENDIF
2720 
2721 vartype = var_ord
2722 IF (PRESENT(var)) THEN
2723  vartype = vol7d_vartype(var)
2724 ENDIF
2725 
2726 innx = SIZE(field_in,1); inny = SIZE(field_in,2); innz = SIZE(field_in,3)
Distruttori per le 2 classi.

Generated with Doxygen.