-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…-aspect-base-class Fixes #3247 - Initial implementation of StateItemAspect.
- Loading branch information
Showing
16 changed files
with
897 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
module mapl3g_AspectMap | ||
use mapl3g_StateItemAspect | ||
|
||
#define Key __CHARACTER_DEFERRED | ||
#define T StateItemAspect | ||
#define T_polymorphic | ||
#define Map AspectMap | ||
#define MapIterator AspectMapIterator | ||
#define Pair AspectPairIterator | ||
|
||
#include "map/template.inc" | ||
|
||
#undef Pair | ||
#undef MapIterator | ||
#undef Map | ||
#undef T_polymorphic | ||
#undef T | ||
#undef Key | ||
|
||
end module mapl3g_AspectMap |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
#include "MAPL_Generic.h" | ||
|
||
module mapl3g_GeomAspect | ||
use mapl3g_StateItemAspect | ||
use mapl3g_geom_mgr, only: MAPL_SameGeom | ||
use mapl3g_regridder_mgr, only: EsmfRegridderParam | ||
use mapl3g_ExtensionAction | ||
use mapl3g_RegridAction | ||
use mapl3g_NullAction | ||
use mapl_ErrorHandling | ||
use ESMF, only: ESMF_Geom | ||
implicit none | ||
private | ||
|
||
public :: GeomAspect | ||
|
||
|
||
type, extends(StateItemAspect) :: GeomAspect | ||
private | ||
type(ESMF_Geom) :: geom | ||
type(EsmfRegridderParam) :: regridder_param | ||
contains | ||
procedure :: matches | ||
procedure :: make_action | ||
procedure :: supports_conversion_general | ||
procedure :: supports_conversion_specific | ||
end type GeomAspect | ||
|
||
interface GeomAspect | ||
procedure new_GeomAspect | ||
end interface | ||
|
||
contains | ||
|
||
function new_GeomAspect(geom, regridder_param, is_mirror, is_time_dependent) result(aspect) | ||
type(GeomAspect) :: aspect | ||
type(ESMF_Geom), intent(in) :: geom | ||
type(EsmfRegridderParam), intent(in) :: regridder_param | ||
logical, optional, intent(in) :: is_mirror | ||
logical, optional, intent(in) :: is_time_dependent | ||
|
||
aspect%geom = geom | ||
aspect%regridder_param = regridder_param | ||
call aspect%set_mirror(is_mirror) | ||
call aspect%set_time_dependent(is_time_dependent) | ||
|
||
end function new_GeomAspect | ||
|
||
! Generally, geoms can be converted via RouteHandle, but there | ||
! are definitely many exceptions. A better implementation here could attempt to create | ||
! the relevant regridder. | ||
logical function supports_conversion_general(src) | ||
class(GeomAspect), intent(in) :: src | ||
supports_conversion_general = .true. | ||
end function supports_conversion_general | ||
|
||
logical function supports_conversion_specific(src, dst) | ||
class(GeomAspect), intent(in) :: src | ||
class(StateItemAspect), intent(in) :: dst | ||
supports_conversion_specific = .true. | ||
end function supports_conversion_specific | ||
|
||
logical function matches(src, dst) | ||
class(GeomAspect), intent(in) :: src | ||
class(StateItemAspect), intent(in) :: dst | ||
|
||
select type(dst) | ||
class is (GeomAspect) | ||
matches = MAPL_SameGeom(src%geom, dst%geom) | ||
class default | ||
matches = .false. | ||
end select | ||
|
||
end function matches | ||
|
||
function make_action(src, dst, rc) result(action) | ||
class(ExtensionAction), allocatable :: action | ||
class(GeomAspect), intent(in) :: src | ||
class(StateItemAspect), intent(in) :: dst | ||
integer, optional, intent(out) :: rc | ||
|
||
select type(dst) | ||
class is (GeomAspect) | ||
action = RegridAction(src%geom, dst%geom, dst%regridder_param) | ||
class default | ||
action = NullAction() | ||
_FAIL('src is GeomAspect but dst is different subclass') | ||
end select | ||
|
||
_RETURN(_SUCCESS) | ||
end function make_action | ||
|
||
end module mapl3g_GeomAspect |
Oops, something went wrong.